Sebastian Andrzej Siewior <[email protected]> writes:
> Some gadgets provide custom entry here. Some may override it with an
> etntry that is also created by composite if there was no value sumbitted
> at all.
> This patch removes all "custom manufacturer" strings which are the same
> as these which are created by composite. Then it moves the creation of
> the default manufacturer string to usb_composite_overwrite_options() in
> case no command line argument has been used and the entry is still an
> empty string.
> By doing this we get rid of the global variable "composite_manufacturer"
> in composite.
>
> Signed-off-by: Sebastian Andrzej Siewior <[email protected]>

Acked-by: Michal Nazarewicz <[email protected]>

> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index b477d9e..1f0e59c 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -1695,6 +1667,11 @@ void usb_composite_overwrite_options(struct 
> usb_composite_dev *cdev,
>       if (covr->manufacturer) {
>               desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
>               dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr->manufacturer;
> +
> +     } else if (!strlen(dev_str[USB_GADGET_MANUFACTURER_IDX].s)) {

I'd still go with:

+       } else if (!*dev_str[USB_GADGET_MANUFACTURER_IDX].s) {

but no pressure.

> +             desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
> +             cdev->def_manufacturer = composite_default_mfr(cdev->gadget);
> +             dev_str[USB_GADGET_MANUFACTURER_IDX].s = cdev->def_manufacturer;
>       }
>  
>       if (covr->product) {

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

Attachment: pgpJUm5TPsLm9.pgp
Description: PGP signature

Reply via email to