Re: [PATCH 7/7 v2] usb/gadget: remove global struct usb_composite_driver in composite

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

 



Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> writes:
> This patch removes the global variable usb_composite_driver() in

s/()//, otherwise it looks like a function name. :)

> composite.c. The private data which was saved there is now passed via
> an additional argument to the bind() function in struct
> usb_gadget_driver.
>
> Only the "old-style" UDC drivers have to be touched here, new style are
> doing it right because this change is made in udc-core.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

> diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
> index 187d211..fc0ec5e 100644
> --- a/drivers/usb/gadget/amd5536udc.c
> +++ b/drivers/usb/gadget/amd5536udc.c
> @@ -1401,7 +1401,7 @@ static int udc_wakeup(struct usb_gadget *gadget)
>  }
>  
>  static int amd5536_start(struct usb_gadget_driver *driver,
> -		int (*bind)(struct usb_gadget *));
> +		int (*bind)(struct usb_gadget *, struct usb_gadget_driver *));
>  static int amd5536_stop(struct usb_gadget_driver *driver);
>  /* gadget operations */
>  static const struct usb_gadget_ops udc_ops = {
> @@ -1914,7 +1914,7 @@ static int setup_ep0(struct udc *dev)
>  
>  /* Called by gadget driver to register itself */
>  static int amd5536_start(struct usb_gadget_driver *driver,
> -		int (*bind)(struct usb_gadget *))
> +		int (*bind)(struct usb_gadget *, struct usb_gadget_driver *))
>  {
>  	struct udc		*dev = udc;
>  	int			retval;
> @@ -1932,7 +1932,7 @@ static int amd5536_start(struct usb_gadget_driver *driver,
>  	dev->driver = driver;
>  	dev->gadget.dev.driver = &driver->driver;
>  
> -	retval = bind(&dev->gadget);
> +	retval = bind(&dev->gadget, driver);
>  
>  	/* Some gadget drivers use both ep0 directions.
>  	 * NOTE: to gadget driver, ep0 is just one endpoint...
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 29d5f70..598df69 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -31,8 +31,6 @@
>  /* big enough to hold our biggest descriptor */
>  #define USB_BUFSIZ	1024
>  
> -static struct usb_composite_driver *composite;
> -
>  /* Some systems will need runtime overrides for the  product identifiers
>   * published in the device descriptor, either numbers or strings or both.
>   * String parameters are in UTF-8 (superset of ASCII's 7 bit characters).
> @@ -889,6 +887,7 @@ static int lookup_string(
>  static int get_string(struct usb_composite_dev *cdev,
>  		void *buf, u16 language, int id)
>  {
> +	struct usb_composite_driver	*cdriver = cdev->driver;

Should you keep the “composite” name for the variable, the rest of the
patch would be a bit shorter. :)

>  	struct usb_configuration	*c;
>  	struct usb_function		*f;
>  	int				len;

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--

Attachment: pgpuKDER2aOfz.pgp
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux