On 2012-03-30 19:03, Dan Carpenter wrote:
On Fri, Mar 30, 2012 at 05:15:05PM +0100, Ian Abbott wrote:
Change the usbdux driver to use the new attach_usb() hook in struct
comedi_driver to auto-configure probed USB devices after the firmware is
loaded.
Signed-off-by: Ian Abbott<abbotti@xxxxxxxxx>
---
drivers/staging/comedi/drivers/usbdux.c | 110 +++++++++++++++++++++----------
1 files changed, 76 insertions(+), 34 deletions(-)
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index 781da44..c3f928f 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -2617,46 +2617,22 @@ static void usbduxsub_disconnect(struct usb_interface *intf)
dev_dbg(&intf->dev, "comedi_: disconnected from the usb\n");
}
-/* is called when comedi-config is called */
-static int usbdux_attach(struct comedi_device *dev, struct comedi_devconfig *it)
+/* common part of attach and attach_usb */
+static int usbdux_attach_common(struct comedi_device *dev,
+ struct usbduxsub *udev,
+ void *aux_data, int aux_len)
{
int ret;
- int index;
- int i;
- struct usbduxsub *udev;
-
+ int index = (int)(udev - usbduxsub);
^^^^^^^^^^^^^^^^^^^^^^^
This is a sort of ugly. It should be documented in front of the
function that udev has to be a pointer to an element from the
usbduxsub[] array. We only use "index" for a printk. I'd be
tempted to just remove the printk(). The other cleaner way would
be to pass the index directly but that would be more work.
The main reason I didn't bother passing it as a parameter is that it was
only used in that dev_info/printk. I'd also be tempted to remove it.
There is a later dev_info in the same function that says the device has
been attached, without mentioning the index, and no other messages refer
to the index, so the single message that does mention the index doesn't
seem very useful.
I'd just like Bernd's opinion on the matter first.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@xxxxxxxxx> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel