From: H Hartley Sweeten Date: Wed, 27 Jun 2012 01:10:22 +0000 (-0700) Subject: staging: comedi: cb_pcidas: cleanup cb_pcidas_ao_fifo_winsn() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b78332daf47b624bef6220f1acf64ee49d38c1ad;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: comedi: cb_pcidas: cleanup cb_pcidas_ao_fifo_winsn() Create local variables for the channel and range in order to cleanup to mask/set of the ao_control_bits. Remove the extra space in all the comments. Return the number of data parameters used (insn->n) to indicate success instead of the open coded '1'. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 2a282d3c9c2c..bbbb9e43d504 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -498,32 +498,29 @@ static int cb_pcidas_ao_fifo_winsn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct cb_pcidas_private *devpriv = dev->private; - int channel; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); unsigned long flags; - /* clear dac fifo */ + /* clear dac fifo */ outw(0, devpriv->ao_registers + DACFIFOCLR); - /* set channel and range */ - channel = CR_CHAN(insn->chanspec); + /* set channel and range */ spin_lock_irqsave(&dev->spinlock, flags); - devpriv->ao_control_bits &= - ~DAC_CHAN_EN(0) & ~DAC_CHAN_EN(1) & ~DAC_RANGE_MASK(channel) & - ~DAC_PACER_MASK; - devpriv->ao_control_bits |= - DACEN | DAC_RANGE(channel, - CR_RANGE(insn-> - chanspec)) | DAC_CHAN_EN(channel) | - DAC_START; + devpriv->ao_control_bits &= (~DAC_CHAN_EN(0) & ~DAC_CHAN_EN(1) & + ~DAC_RANGE_MASK(chan) & ~DAC_PACER_MASK); + devpriv->ao_control_bits |= (DACEN | DAC_RANGE(chan, range) | + DAC_CHAN_EN(chan) | DAC_START); outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); spin_unlock_irqrestore(&dev->spinlock, flags); - /* remember value for readback */ - devpriv->ao_value[channel] = data[0]; - /* send data */ + /* remember value for readback */ + devpriv->ao_value[chan] = data[0]; + + /* send data */ outw(data[0], devpriv->ao_registers + DACDATA); - return 1; + return insn->n; } static int cb_pcidas_ao_readback_insn(struct comedi_device *dev,