Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a99d8a45 authored by Michal Nazarewicz's avatar Michal Nazarewicz Committed by Greg Kroah-Hartman
Browse files

USB: gadget: g_multi: moved strings handling code to composite



This patch removes some of the string registration from the
Multifunction Composite Gadget as composite layer can handle
the iManufacturer and iProduct for us.

This also adds the "needs_serial" so that composite layer will
issue a warning if user space fails to provide the iSerialNumber
module parameter.

Signed-off-by: default avatarMichal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7c2b61d0
Loading
Loading
Loading
Loading
+3 −16
Original line number Original line Diff line number Diff line
@@ -121,8 +121,6 @@ static const struct usb_descriptor_header *otg_desc[] = {




enum {
enum {
	MULTI_STRING_MANUFACTURER_IDX,
	MULTI_STRING_PRODUCT_IDX,
#ifdef CONFIG_USB_G_MULTI_RNDIS
#ifdef CONFIG_USB_G_MULTI_RNDIS
	MULTI_STRING_RNDIS_CONFIG_IDX,
	MULTI_STRING_RNDIS_CONFIG_IDX,
#endif
#endif
@@ -131,11 +129,7 @@ enum {
#endif
#endif
};
};


static char manufacturer[50];

static struct usb_string strings_dev[] = {
static struct usb_string strings_dev[] = {
	[MULTI_STRING_MANUFACTURER_IDX].s = manufacturer,
	[MULTI_STRING_PRODUCT_IDX].s      = DRIVER_DESC,
#ifdef CONFIG_USB_G_MULTI_RNDIS
#ifdef CONFIG_USB_G_MULTI_RNDIS
	[MULTI_STRING_RNDIS_CONFIG_IDX].s = "Multifunction with RNDIS",
	[MULTI_STRING_RNDIS_CONFIG_IDX].s = "Multifunction with RNDIS",
#endif
#endif
@@ -314,20 +308,11 @@ static int __ref multi_bind(struct usb_composite_dev *cdev)
		device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099);
		device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099);
	}
	}


	/* allocate string descriptor numbers */
	/* allocate string IDs */
	snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
	         init_utsname()->sysname, init_utsname()->release,
	         gadget->name);

	status = usb_string_ids_tab(cdev, strings_dev);
	status = usb_string_ids_tab(cdev, strings_dev);
	if (unlikely(status < 0))
	if (unlikely(status < 0))
		goto fail2;
		goto fail2;


	device_desc.iManufacturer =
		strings_dev[MULTI_STRING_MANUFACTURER_IDX].id;
	device_desc.iProduct      =
		strings_dev[MULTI_STRING_PRODUCT_IDX].id;

	/* register configurations */
	/* register configurations */
	status = rndis_config_register(cdev);
	status = rndis_config_register(cdev);
	if (unlikely(status < 0))
	if (unlikely(status < 0))
@@ -370,6 +355,8 @@ static struct usb_composite_driver multi_driver = {
	.strings	= dev_strings,
	.strings	= dev_strings,
	.bind		= multi_bind,
	.bind		= multi_bind,
	.unbind		= __exit_p(multi_unbind),
	.unbind		= __exit_p(multi_unbind),
	.iProduct	= DRIVER_DESC,
	.needs_serial	= 1,
};
};