[PATCHv8 06/13] USB: gadget: g_multi: moved strings handling code to composite

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Michal Nazarewicz
Date: Thursday, August 12, 2010 - 8:43 am

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: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/usb/gadget/multi.c |   19 +++----------------
 1 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 36d67a3..ca51661 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -121,8 +121,6 @@ static const struct usb_descriptor_header *otg_desc[] = {
 
 
 enum {
-	MULTI_STRING_MANUFACTURER_IDX,
-	MULTI_STRING_PRODUCT_IDX,
 #ifdef CONFIG_USB_G_MULTI_RNDIS
 	MULTI_STRING_RNDIS_CONFIG_IDX,
 #endif
@@ -131,11 +129,7 @@ enum {
 #endif
 };
 
-static char manufacturer[50];
-
 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
 	[MULTI_STRING_RNDIS_CONFIG_IDX].s = "Multifunction with RNDIS",
 #endif
@@ -314,20 +308,11 @@ static int __ref multi_bind(struct usb_composite_dev *cdev)
 		device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099);
 	}
 
-	/* allocate string descriptor numbers */
-	snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
-	         init_utsname()->sysname, init_utsname()->release,
-	         gadget->name);
-
+	/* allocate string IDs */
 	status = usb_string_ids_tab(cdev, strings_dev);
 	if (unlikely(status < 0))
 		goto fail2;
 
-	device_desc.iManufacturer =
-		strings_dev[MULTI_STRING_MANUFACTURER_IDX].id;
-	device_desc.iProduct      =
-		strings_dev[MULTI_STRING_PRODUCT_IDX].id;
-
 	/* register configurations */
 	status = rndis_config_register(cdev);
 	if (unlikely(status < 0))
@@ -370,6 +355,8 @@ static struct usb_composite_driver multi_driver = {
 	.strings	= dev_strings,
 	.bind		= multi_bind,
 	.unbind		= __exit_p(multi_unbind),
+	.iProduct	= DRIVER_DESC,
+	.needs_serial	= 1,
 };
 
 
-- 
1.7.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCHv8 01/13] USB: gadget: g_multi: fixed vendor and pro ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 02/13] USB: gadget: g_ffs: fixed vendor and produ ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 03/13] USB: gadget: composite: Better string over ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 04/13] USB: gadget: mass_storage: moved strings h ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 05/13] USB: gadget: functionfs: code cleanup, Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 06/13] USB: gadget: g_multi: moved strings handli ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 07/13] usb: gadget: storage: remove nofua file wh ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 08/13] usb: gadget: mass_storage: optional SCSI W ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 10/13] usb gadget: don't save bind callback in st ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 11/13] usb gadget: don't save bind callback in st ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 12/13] usb gadget: don't save bind callback in st ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
[PATCHv8 13/13] init.h: add some more documentation to __r ..., Michal Nazarewicz, (Thu Aug 12, 8:43 am)
Re: [PATCHv8 11/13] usb gadget: don't save bind callback i ..., Uwe Kleine-König, (Thu Aug 12, 8:45 am)
Re: [PATCHv8 03/13] USB: gadget: composite: Better string ..., Michał Nazarewicz, (Wed Sep 1, 5:57 pm)