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@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/usbduxfast.c | 47 ++++++++++++----------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 0770676..8826fa5 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -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 = 0x0fff; - 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 = 0x0fff; + 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) -- 2.4.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel