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/audio.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/audio.c')
-rw-r--r-- | drivers/usb/gadget/audio.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 55b593c5a9c8..8857b6eeb6a2 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c | |||
@@ -33,14 +33,12 @@ USB_GADGET_COMPOSITE_OPTIONS(); | |||
33 | 33 | ||
34 | /* string IDs are assigned dynamically */ | 34 | /* string IDs are assigned dynamically */ |
35 | 35 | ||
36 | #define STRING_MANUFACTURER_IDX 0 | ||
37 | #define STRING_PRODUCT_IDX 1 | ||
38 | |||
39 | static char manufacturer[50]; | 36 | static char manufacturer[50]; |
40 | 37 | ||
41 | static struct usb_string strings_dev[] = { | 38 | static struct usb_string strings_dev[] = { |
42 | [STRING_MANUFACTURER_IDX].s = manufacturer, | 39 | [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, |
43 | [STRING_PRODUCT_IDX].s = DRIVER_DESC, | 40 | [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, |
41 | [USB_GADGET_SERIAL_IDX].s = "", | ||
44 | { } /* end of list */ | 42 | { } /* end of list */ |
45 | }; | 43 | }; |
46 | 44 | ||
@@ -170,8 +168,8 @@ static int __init audio_bind(struct usb_composite_dev *cdev) | |||
170 | status = usb_string_ids_tab(cdev, strings_dev); | 168 | status = usb_string_ids_tab(cdev, strings_dev); |
171 | if (status < 0) | 169 | if (status < 0) |
172 | goto fail; | 170 | goto fail; |
173 | device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; | 171 | device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id; |
174 | device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; | 172 | device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; |
175 | 173 | ||
176 | status = usb_add_config(cdev, &audio_config_driver, audio_do_config); | 174 | status = usb_add_config(cdev, &audio_config_driver, audio_do_config); |
177 | if (status < 0) | 175 | if (status < 0) |