staging: comedi: usbdux: tidy up usbdux_ao_insn_read()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 25 Jul 2013 23:04:34 +0000 (16:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2013 22:09:55 +0000 (15:09 -0700)
Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/usbdux.c

index a81b4b17b297a7b18d1723ffaba87b3afe3713cd..4159936a6312fc471d73ab95683cd66d523e25cb 100644 (file)
@@ -1016,26 +1016,21 @@ ai_read_exit:
        return ret ? ret : insn->n;
 }
 
-/************************************/
-/* analog out */
-
 static int usbdux_ao_insn_read(struct comedi_device *dev,
                               struct comedi_subdevice *s,
-                              struct comedi_insn *insn, unsigned int *data)
+                              struct comedi_insn *insn,
+                              unsigned int *data)
 {
+       struct usbdux_private *devpriv = dev->private;
+       unsigned int chan = CR_CHAN(insn->chanspec);
        int i;
-       int chan = CR_CHAN(insn->chanspec);
-       struct usbdux_private *this_usbduxsub = dev->private;
 
-       if (!this_usbduxsub)
-               return -EFAULT;
-
-       down(&this_usbduxsub->sem);
+       down(&devpriv->sem);
        for (i = 0; i < insn->n; i++)
-               data[i] = this_usbduxsub->out_buffer[chan];
+               data[i] = devpriv->out_buffer[chan];
+       up(&devpriv->sem);
 
-       up(&this_usbduxsub->sem);
-       return i;
+       return insn->n;
 }
 
 static int usbdux_ao_insn_write(struct comedi_device *dev,