[PATCH 10/10] staging: comedi: usbdux: use attach_usb() hook
Dan Carpenter
dan.carpenter at oracle.com
Fri Mar 30 18:03:29 UTC 2012
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 at mev.co.uk>
> ---
> 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.
> struct comedi_subdevice *s = NULL;
> - dev->private = NULL;
> -
regards,
dan carpenter
More information about the devel
mailing list