]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: comedi: usbduxfast: absorb usbduxfast_attach_common()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 24 Aug 2015 17:14:05 +0000 (10:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2015 01:24:25 +0000 (18:24 -0700)
This function is only called by the (*auto_attach) to do the final
setup of the analog input subdevice.

For aesthetics absorb it into usbduxfast_auto_attach() and reorder
the initialization of the subdevice to better follow the "norm" in
comedi drivers.

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/usbduxfast.c

index 149b558a8896fa0b74ca7f18abfd4d193bdf8a98..4c86a9a913cd32ea2100fb78884a70e8129840fb 100644 (file)
@@ -840,32 +840,6 @@ static int usbduxfast_ai_insn_read(struct comedi_device *dev,
        return insn->n;
 }
 
-static int usbduxfast_attach_common(struct comedi_device *dev)
-{
-       struct comedi_subdevice *s;
-       int ret;
-
-       ret = comedi_alloc_subdevices(dev, 1);
-       if (ret)
-               return ret;
-
-       /* Analog Input subdevice */
-       s = &dev->subdevices[0];
-       dev->read_subdev = s;
-       s->type         = COMEDI_SUBD_AI;
-       s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ;
-       s->n_chan       = 16;
-       s->len_chanlist = 16;
-       s->insn_read    = usbduxfast_ai_insn_read;
-       s->do_cmdtest   = usbduxfast_ai_cmdtest;
-       s->do_cmd       = usbduxfast_ai_cmd;
-       s->cancel       = usbduxfast_ai_cancel;
-       s->maxdata      = 0x1000;       /* 12-bit + 1 overflow bit */
-       s->range_table  = &range_usbduxfast_ai_range;
-
-       return 0;
-}
-
 static int usbduxfast_upload_firmware(struct comedi_device *dev,
                                      const u8 *data, size_t size,
                                      unsigned long context)
@@ -943,6 +917,7 @@ static int usbduxfast_auto_attach(struct comedi_device *dev,
        struct usb_interface *intf = comedi_to_usb_interface(dev);
        struct usb_device *usb = comedi_to_usb_dev(dev);
        struct usbduxfast_private *devpriv;
+       struct comedi_subdevice *s;
        int ret;
 
        if (usb->speed != USB_SPEED_HIGH) {
@@ -985,7 +960,25 @@ static int usbduxfast_auto_attach(struct comedi_device *dev,
        if (ret)
                return ret;
 
-       return usbduxfast_attach_common(dev);
+       ret = comedi_alloc_subdevices(dev, 1);
+       if (ret)
+               return ret;
+
+       /* Analog Input subdevice */
+       s = &dev->subdevices[0];
+       dev->read_subdev = s;
+       s->type         = COMEDI_SUBD_AI;
+       s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ;
+       s->n_chan       = 16;
+       s->maxdata      = 0x1000;       /* 12-bit + 1 overflow bit */
+       s->range_table  = &range_usbduxfast_ai_range;
+       s->insn_read    = usbduxfast_ai_insn_read;
+       s->len_chanlist = s->n_chan;
+       s->do_cmdtest   = usbduxfast_ai_cmdtest;
+       s->do_cmd       = usbduxfast_ai_cmd;
+       s->cancel       = usbduxfast_ai_cancel;
+
+       return 0;
 }
 
 static void usbduxfast_detach(struct comedi_device *dev)