diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-09-10 09:01:57 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-09-10 09:13:02 -0400 |
commit | d33f74fce3756d51a0203cec3d0d278e3b48d827 (patch) | |
tree | 2037aa5d113165f9d6379d2415b31837cc44e006 /drivers/usb/gadget | |
parent | 2d35ee47aaafac152bc4bc5020660ffa1753ab02 (diff) |
usb: gadget: remove string override from struct usb_composite_driver
The struct usb_composite_driver members iProduct, iSerial and
iManufacturer can be entered directly via the string array. There is no
need for them to appear here.
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')
-rw-r--r-- | drivers/usb/gadget/composite.c | 29 | ||||
-rw-r--r-- | drivers/usb/gadget/g_ffs.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/mass_storage.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/multi.c | 4 |
4 files changed, 13 insertions, 28 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 47b9130968bc..f3689e1bf4b2 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -904,11 +904,7 @@ static int get_string(struct usb_composite_dev *cdev, | |||
904 | * check if the string has not been overridden. | 904 | * check if the string has not been overridden. |
905 | */ | 905 | */ |
906 | if (cdev->manufacturer_override == id) | 906 | if (cdev->manufacturer_override == id) |
907 | str = composite->iManufacturer ?: composite_manufacturer; | 907 | str = composite_manufacturer; |
908 | else if (cdev->product_override == id) | ||
909 | str = composite->iProduct; | ||
910 | else if (cdev->serial_override == id) | ||
911 | str = composite->iSerialNumber; | ||
912 | else | 908 | else |
913 | str = NULL; | 909 | str = NULL; |
914 | if (str) { | 910 | if (str) { |
@@ -1483,26 +1479,17 @@ static int composite_bind(struct usb_gadget *gadget, | |||
1483 | 1479 | ||
1484 | /* string overrides */ | 1480 | /* string overrides */ |
1485 | if (!cdev->desc.iManufacturer) { | 1481 | if (!cdev->desc.iManufacturer) { |
1486 | if (!composite->iManufacturer) | 1482 | snprintf(composite_manufacturer, |
1487 | snprintf(composite_manufacturer, | 1483 | sizeof composite_manufacturer, |
1488 | sizeof composite_manufacturer, | 1484 | "%s %s with %s", |
1489 | "%s %s with %s", | 1485 | init_utsname()->sysname, |
1490 | init_utsname()->sysname, | 1486 | init_utsname()->release, |
1491 | init_utsname()->release, | 1487 | gadget->name); |
1492 | gadget->name); | ||
1493 | 1488 | ||
1494 | cdev->manufacturer_override = | 1489 | cdev->manufacturer_override = |
1495 | override_id(cdev, &cdev->desc.iManufacturer); | 1490 | override_id(cdev, &cdev->desc.iManufacturer); |
1496 | } | 1491 | } |
1497 | 1492 | ||
1498 | if (!cdev->desc.iProduct && composite->iProduct) | ||
1499 | cdev->product_override = | ||
1500 | override_id(cdev, &cdev->desc.iProduct); | ||
1501 | |||
1502 | if (composite->iSerialNumber) | ||
1503 | cdev->serial_override = | ||
1504 | override_id(cdev, &cdev->desc.iSerialNumber); | ||
1505 | |||
1506 | /* has userspace failed to provide a serial number? */ | 1493 | /* has userspace failed to provide a serial number? */ |
1507 | if (composite->needs_serial && !cdev->desc.iSerialNumber) | 1494 | if (composite->needs_serial && !cdev->desc.iSerialNumber) |
1508 | WARNING(cdev, "userspace failed to provide iSerialNumber\n"); | 1495 | WARNING(cdev, "userspace failed to provide iSerialNumber\n"); |
@@ -1619,8 +1606,6 @@ int usb_composite_probe(struct usb_composite_driver *driver) | |||
1619 | 1606 | ||
1620 | if (!driver->name) | 1607 | if (!driver->name) |
1621 | driver->name = "composite"; | 1608 | driver->name = "composite"; |
1622 | if (!driver->iProduct) | ||
1623 | driver->iProduct = driver->name; | ||
1624 | 1609 | ||
1625 | driver->gadget_driver = composite_driver_template; | 1610 | driver->gadget_driver = composite_driver_template; |
1626 | gadget_driver = &driver->gadget_driver; | 1611 | gadget_driver = &driver->gadget_driver; |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 16d18873ebeb..eaaed199e453 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -117,7 +117,7 @@ static const struct usb_descriptor_header *gfs_otg_desc[] = { | |||
117 | /* String IDs are assigned dynamically */ | 117 | /* String IDs are assigned dynamically */ |
118 | static struct usb_string gfs_strings[] = { | 118 | static struct usb_string gfs_strings[] = { |
119 | [USB_GADGET_MANUFACTURER_IDX].s = "", | 119 | [USB_GADGET_MANUFACTURER_IDX].s = "", |
120 | [USB_GADGET_PRODUCT_IDX].s = "", | 120 | [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, |
121 | [USB_GADGET_SERIAL_IDX].s = "", | 121 | [USB_GADGET_SERIAL_IDX].s = "", |
122 | #ifdef CONFIG_USB_FUNCTIONFS_RNDIS | 122 | #ifdef CONFIG_USB_FUNCTIONFS_RNDIS |
123 | { .s = "FunctionFS + RNDIS" }, | 123 | { .s = "FunctionFS + RNDIS" }, |
@@ -172,7 +172,6 @@ static __refdata struct usb_composite_driver gfs_driver = { | |||
172 | .max_speed = USB_SPEED_HIGH, | 172 | .max_speed = USB_SPEED_HIGH, |
173 | .bind = gfs_bind, | 173 | .bind = gfs_bind, |
174 | .unbind = gfs_unbind, | 174 | .unbind = gfs_unbind, |
175 | .iProduct = DRIVER_DESC, | ||
176 | }; | 175 | }; |
177 | 176 | ||
178 | static DEFINE_MUTEX(gfs_lock); | 177 | static DEFINE_MUTEX(gfs_lock); |
@@ -360,6 +359,7 @@ static int gfs_bind(struct usb_composite_dev *cdev) | |||
360 | ret = usb_string_ids_tab(cdev, gfs_strings); | 359 | ret = usb_string_ids_tab(cdev, gfs_strings); |
361 | if (unlikely(ret < 0)) | 360 | if (unlikely(ret < 0)) |
362 | goto error; | 361 | goto error; |
362 | gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; | ||
363 | 363 | ||
364 | for (i = func_num; --i; ) { | 364 | for (i = func_num; --i; ) { |
365 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); | 365 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); |
diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c index 6f5a3b232d81..50da3c88cb06 100644 --- a/drivers/usb/gadget/mass_storage.c +++ b/drivers/usb/gadget/mass_storage.c | |||
@@ -85,7 +85,7 @@ static const struct usb_descriptor_header *otg_desc[] = { | |||
85 | 85 | ||
86 | static struct usb_string strings_dev[] = { | 86 | static struct usb_string strings_dev[] = { |
87 | [USB_GADGET_MANUFACTURER_IDX].s = "", | 87 | [USB_GADGET_MANUFACTURER_IDX].s = "", |
88 | [USB_GADGET_PRODUCT_IDX].s = "", | 88 | [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, |
89 | [USB_GADGET_SERIAL_IDX].s = "", | 89 | [USB_GADGET_SERIAL_IDX].s = "", |
90 | { } /* end of list */ | 90 | { } /* end of list */ |
91 | }; | 91 | }; |
@@ -160,6 +160,7 @@ static int __init msg_bind(struct usb_composite_dev *cdev) | |||
160 | status = usb_string_ids_tab(cdev, strings_dev); | 160 | status = usb_string_ids_tab(cdev, strings_dev); |
161 | if (status < 0) | 161 | if (status < 0) |
162 | return status; | 162 | return status; |
163 | msg_device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; | ||
163 | 164 | ||
164 | status = usb_add_config(cdev, &msg_config_driver, msg_do_config); | 165 | status = usb_add_config(cdev, &msg_config_driver, msg_do_config); |
165 | if (status < 0) | 166 | if (status < 0) |
@@ -177,7 +178,6 @@ static int __init msg_bind(struct usb_composite_dev *cdev) | |||
177 | static __refdata struct usb_composite_driver msg_driver = { | 178 | static __refdata struct usb_composite_driver msg_driver = { |
178 | .name = "g_mass_storage", | 179 | .name = "g_mass_storage", |
179 | .dev = &msg_device_desc, | 180 | .dev = &msg_device_desc, |
180 | .iProduct = DRIVER_DESC, | ||
181 | .max_speed = USB_SPEED_SUPER, | 181 | .max_speed = USB_SPEED_SUPER, |
182 | .needs_serial = 1, | 182 | .needs_serial = 1, |
183 | .strings = dev_strings, | 183 | .strings = dev_strings, |
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index 94b35e5539d7..c158706b5ab0 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c | |||
@@ -115,7 +115,7 @@ enum { | |||
115 | 115 | ||
116 | static struct usb_string strings_dev[] = { | 116 | static struct usb_string strings_dev[] = { |
117 | [USB_GADGET_MANUFACTURER_IDX].s = "", | 117 | [USB_GADGET_MANUFACTURER_IDX].s = "", |
118 | [USB_GADGET_PRODUCT_IDX].s = "", | 118 | [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, |
119 | [USB_GADGET_SERIAL_IDX].s = "", | 119 | [USB_GADGET_SERIAL_IDX].s = "", |
120 | [MULTI_STRING_RNDIS_CONFIG_IDX].s = "Multifunction with RNDIS", | 120 | [MULTI_STRING_RNDIS_CONFIG_IDX].s = "Multifunction with RNDIS", |
121 | [MULTI_STRING_CDC_CONFIG_IDX].s = "Multifunction with CDC ECM", | 121 | [MULTI_STRING_CDC_CONFIG_IDX].s = "Multifunction with CDC ECM", |
@@ -293,6 +293,7 @@ static int __ref multi_bind(struct usb_composite_dev *cdev) | |||
293 | status = usb_string_ids_tab(cdev, strings_dev); | 293 | status = usb_string_ids_tab(cdev, strings_dev); |
294 | if (unlikely(status < 0)) | 294 | if (unlikely(status < 0)) |
295 | goto fail2; | 295 | goto fail2; |
296 | device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; | ||
296 | 297 | ||
297 | /* register configurations */ | 298 | /* register configurations */ |
298 | status = rndis_config_register(cdev); | 299 | status = rndis_config_register(cdev); |
@@ -338,7 +339,6 @@ static __refdata struct usb_composite_driver multi_driver = { | |||
338 | .max_speed = USB_SPEED_HIGH, | 339 | .max_speed = USB_SPEED_HIGH, |
339 | .bind = multi_bind, | 340 | .bind = multi_bind, |
340 | .unbind = __exit_p(multi_unbind), | 341 | .unbind = __exit_p(multi_unbind), |
341 | .iProduct = DRIVER_DESC, | ||
342 | .needs_serial = 1, | 342 | .needs_serial = 1, |
343 | }; | 343 | }; |
344 | 344 | ||