Re: [PATCH 18/21] usb/gadget: remove string override from struct usb_composite_driver

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

 



Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> writes:
> The struct usb_composite_driver members iProduct, iSerial and
> iManufacturer can be entered directly via the string array. There is no
> need for them to appear here.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index f3e46a6..b477d9e 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -904,11 +904,7 @@ static int get_string(struct usb_composite_dev *cdev,
>  	 * check if the string has not been overridden.
>  	 */
>  	if (cdev->manufacturer_override == id)
> -		str = cdriver->iManufacturer ?: composite_manufacturer;
> -	else if (cdev->product_override == id)
> -		str = cdriver->iProduct;
> -	else if (cdev->serial_override == id)
> -		str = cdriver->iSerialNumber;
> +		str = composite_manufacturer;
>  	else
>  		str = NULL;
>  	if (str) {
> @@ -1483,26 +1479,17 @@ static int composite_bind(struct usb_gadget *gadget,
>  
>  	/* string overrides */
>  	if (!cdev->desc.iManufacturer) {
> -		if (!cdriver->iManufacturer)
> -			snprintf(composite_manufacturer,
> -				 sizeof composite_manufacturer,
> -				 "%s %s with %s",
> -				 init_utsname()->sysname,
> -				 init_utsname()->release,
> -				 gadget->name);
> +		snprintf(composite_manufacturer,
> +				sizeof composite_manufacturer,
> +				"%s %s with %s",
> +				init_utsname()->sysname,
> +				init_utsname()->release,
> +				gadget->name);
>  
>  		cdev->manufacturer_override =
>  			override_id(cdev, &cdev->desc.iManufacturer);
>  	}
>  
> -	if (!cdev->desc.iProduct && cdriver->iProduct)
> -		cdev->product_override =
> -			override_id(cdev, &cdev->desc.iProduct);
> -
> -	if (cdriver->iSerialNumber)
> -		cdev->serial_override =
> -			override_id(cdev, &cdev->desc.iSerialNumber);
> -
>  	/* has userspace failed to provide a serial number? */
>  	if (cdriver->needs_serial && !cdev->desc.iSerialNumber)
>  		WARNING(cdev, "userspace failed to provide iSerialNumber\n");
> @@ -1625,8 +1612,6 @@ int usb_composite_probe(struct usb_composite_driver *driver)
>  
>  	if (!driver->name)
>  		driver->name = "composite";
> -	if (!driver->iProduct)
> -		driver->iProduct = driver->name;

This leaves gadgets that do not provide name explicitly with no product
name, doesn't it?  At the moment, if gadget does not provide any product
string, the name given in usb_composite_driver is used.  If even that is
not provided, "composite" is assumed.  As far as I can tell, this change
removes that functionality.

>  	driver->gadget_driver = composite_driver_template;
>  	gadget_driver = &driver->gadget_driver;

-- 
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: pgp9ZLp0EQQMt.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