diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-09-06 14:11:21 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-09-10 09:13:00 -0400 |
commit | 276e2e4f1f3e07a0ad891bf757dbcfd655ff5f91 (patch) | |
tree | 5a3d0689815314e2fab55a8c9e0a99d6853c31bd /drivers/usb/gadget/nokia.c | |
parent | 7d16e8d3eb704f5f6eb5a271d5758b495634e8e6 (diff) |
usb: gadget: make sure each gadget is using same index for Product, Serial,…
The index in usb_string array is defined by the gadget. The gadget can
choose which index entry it assigns for the serial number and which the
product name. The gadget has just to ensure that the descriptor contains
the proper string id which is assigned by composite.
If the composite layer knows the index of the "default" information
which will be overwritten by module parameters, it can be used later to
overwrite it.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/nokia.c')
-rw-r--r-- | drivers/usb/gadget/nokia.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c index 5ed927b16c0e..34b97f12b7da 100644 --- a/drivers/usb/gadget/nokia.c +++ b/drivers/usb/gadget/nokia.c | |||
@@ -56,17 +56,16 @@ USB_GADGET_COMPOSITE_OPTIONS(); | |||
56 | 56 | ||
57 | /* string IDs are assigned dynamically */ | 57 | /* string IDs are assigned dynamically */ |
58 | 58 | ||
59 | #define STRING_MANUFACTURER_IDX 0 | 59 | #define STRING_DESCRIPTION_IDX USB_GADGET_FIRST_AVAIL_IDX |
60 | #define STRING_PRODUCT_IDX 1 | ||
61 | #define STRING_DESCRIPTION_IDX 2 | ||
62 | 60 | ||
63 | static char manufacturer_nokia[] = "Nokia"; | 61 | static char manufacturer_nokia[] = "Nokia"; |
64 | static const char product_nokia[] = NOKIA_LONG_NAME; | 62 | static const char product_nokia[] = NOKIA_LONG_NAME; |
65 | static const char description_nokia[] = "PC-Suite Configuration"; | 63 | static const char description_nokia[] = "PC-Suite Configuration"; |
66 | 64 | ||
67 | static struct usb_string strings_dev[] = { | 65 | static struct usb_string strings_dev[] = { |
68 | [STRING_MANUFACTURER_IDX].s = manufacturer_nokia, | 66 | [USB_GADGET_MANUFACTURER_IDX].s = manufacturer_nokia, |
69 | [STRING_PRODUCT_IDX].s = NOKIA_LONG_NAME, | 67 | [USB_GADGET_PRODUCT_IDX].s = NOKIA_LONG_NAME, |
68 | [USB_GADGET_SERIAL_IDX].s = "", | ||
70 | [STRING_DESCRIPTION_IDX].s = description_nokia, | 69 | [STRING_DESCRIPTION_IDX].s = description_nokia, |
71 | { } /* end of list */ | 70 | { } /* end of list */ |
72 | }; | 71 | }; |
@@ -168,8 +167,8 @@ static int __init nokia_bind(struct usb_composite_dev *cdev) | |||
168 | status = usb_string_ids_tab(cdev, strings_dev); | 167 | status = usb_string_ids_tab(cdev, strings_dev); |
169 | if (status < 0) | 168 | if (status < 0) |
170 | goto err_usb; | 169 | goto err_usb; |
171 | device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; | 170 | device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id; |
172 | device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; | 171 | device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; |
173 | status = strings_dev[STRING_DESCRIPTION_IDX].id; | 172 | status = strings_dev[STRING_DESCRIPTION_IDX].id; |
174 | nokia_config_500ma_driver.iConfiguration = status; | 173 | nokia_config_500ma_driver.iConfiguration = status; |
175 | nokia_config_100ma_driver.iConfiguration = status; | 174 | nokia_config_100ma_driver.iConfiguration = status; |