Re: [PATCH 10/10] staging: comedi: usbdux: use attach_usb() hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


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.

>  	struct comedi_subdevice *s = NULL;
> -	dev->private = NULL;
> -

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Video for Linux]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Photos]     [Yosemite Photos]     [Free Singles Community]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Yosemite Backpacking]

Add to Google Powered by Linux