aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/acm_ms.c12
-rw-r--r--drivers/usb/gadget/audio.c9
-rw-r--r--drivers/usb/gadget/cdc2.c10
-rw-r--r--drivers/usb/gadget/composite.c67
-rw-r--r--drivers/usb/gadget/ether.c12
-rw-r--r--drivers/usb/gadget/f_hid.c1
-rw-r--r--drivers/usb/gadget/f_mass_storage.c1
-rw-r--r--drivers/usb/gadget/f_midi.c1
-rw-r--r--drivers/usb/gadget/g_ffs.c1
-rw-r--r--drivers/usb/gadget/gmidi.c1
-rw-r--r--drivers/usb/gadget/hid.c10
-rw-r--r--drivers/usb/gadget/mass_storage.c2
-rw-r--r--drivers/usb/gadget/multi.c2
-rw-r--r--drivers/usb/gadget/ncm.c12
-rw-r--r--drivers/usb/gadget/nokia.c1
-rw-r--r--drivers/usb/gadget/printer.c8
-rw-r--r--drivers/usb/gadget/serial.c9
-rw-r--r--drivers/usb/gadget/zero.c9
18 files changed, 31 insertions, 137 deletions
diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c
index 35db6aa57281..d280f164887c 100644
--- a/drivers/usb/gadget/acm_ms.c
+++ b/drivers/usb/gadget/acm_ms.c
@@ -15,7 +15,6 @@
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/utsname.h>
19 18
20#include "u_serial.h" 19#include "u_serial.h"
21 20
@@ -87,13 +86,9 @@ static const struct usb_descriptor_header *otg_desc[] = {
87 NULL, 86 NULL,
88}; 87};
89 88
90
91/* string IDs are assigned dynamically */ 89/* string IDs are assigned dynamically */
92
93static char manufacturer[50];
94
95static struct usb_string strings_dev[] = { 90static struct usb_string strings_dev[] = {
96 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, 91 [USB_GADGET_MANUFACTURER_IDX].s = "",
97 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, 92 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
98 [USB_GADGET_SERIAL_IDX].s = "", 93 [USB_GADGET_SERIAL_IDX].s = "",
99 { } /* end of list */ 94 { } /* end of list */
@@ -186,11 +181,6 @@ static int __init acm_ms_bind(struct usb_composite_dev *cdev)
186 * Allocate string descriptor numbers ... note that string 181 * Allocate string descriptor numbers ... note that string
187 * contents can be overridden by the composite_dev glue. 182 * contents can be overridden by the composite_dev glue.
188 */ 183 */
189
190 /* device descriptor strings: manufacturer, product */
191 snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
192 init_utsname()->sysname, init_utsname()->release,
193 gadget->name);
194 status = usb_string_ids_tab(cdev, strings_dev); 184 status = usb_string_ids_tab(cdev, strings_dev);
195 if (status < 0) 185 if (status < 0)
196 goto fail1; 186 goto fail1;
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c
index 8857b6eeb6a2..1f81e0f4fab9 100644
--- a/drivers/usb/gadget/audio.c
+++ b/drivers/usb/gadget/audio.c
@@ -12,7 +12,6 @@
12/* #define VERBOSE_DEBUG */ 12/* #define VERBOSE_DEBUG */
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/utsname.h>
16#include <linux/usb/composite.h> 15#include <linux/usb/composite.h>
17 16
18#include "gadget_chips.h" 17#include "gadget_chips.h"
@@ -33,10 +32,8 @@ USB_GADGET_COMPOSITE_OPTIONS();
33 32
34/* string IDs are assigned dynamically */ 33/* string IDs are assigned dynamically */
35 34
36static char manufacturer[50];
37
38static struct usb_string strings_dev[] = { 35static struct usb_string strings_dev[] = {
39 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, 36 [USB_GADGET_MANUFACTURER_IDX].s = "",
40 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, 37 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
41 [USB_GADGET_SERIAL_IDX].s = "", 38 [USB_GADGET_SERIAL_IDX].s = "",
42 { } /* end of list */ 39 { } /* end of list */
@@ -161,10 +158,6 @@ static int __init audio_bind(struct usb_composite_dev *cdev)
161 __constant_cpu_to_le16(0x0300 | 0x0099); 158 __constant_cpu_to_le16(0x0300 | 0x0099);
162 } 159 }
163 160
164 /* device descriptor strings: manufacturer, product */
165 snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
166 init_utsname()->sysname, init_utsname()->release,
167 cdev->gadget->name);
168 status = usb_string_ids_tab(cdev, strings_dev); 161 status = usb_string_ids_tab(cdev, strings_dev);
169 if (status < 0) 162 if (status < 0)
170 goto fail; 163 goto fail;
diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c
index 8966bdec1534..4e2060bf35e3 100644
--- a/drivers/usb/gadget/cdc2.c
+++ b/drivers/usb/gadget/cdc2.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/utsname.h>
15#include <linux/module.h> 14#include <linux/module.h>
16 15
17#include "u_ether.h" 16#include "u_ether.h"
@@ -90,10 +89,8 @@ static const struct usb_descriptor_header *otg_desc[] = {
90 89
91 90
92/* string IDs are assigned dynamically */ 91/* string IDs are assigned dynamically */
93static char manufacturer[50];
94
95static struct usb_string strings_dev[] = { 92static struct usb_string strings_dev[] = {
96 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, 93 [USB_GADGET_MANUFACTURER_IDX].s = "",
97 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, 94 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
98 [USB_GADGET_SERIAL_IDX].s = "", 95 [USB_GADGET_SERIAL_IDX].s = "",
99 { } /* end of list */ 96 { } /* end of list */
@@ -182,15 +179,10 @@ static int __init cdc_bind(struct usb_composite_dev *cdev)
182 cpu_to_le16(0x0300 | 0x0099); 179 cpu_to_le16(0x0300 | 0x0099);
183 } 180 }
184 181
185
186 /* Allocate string descriptor numbers ... note that string 182 /* Allocate string descriptor numbers ... note that string
187 * contents can be overridden by the composite_dev glue. 183 * contents can be overridden by the composite_dev glue.
188 */ 184 */
189 185
190 /* device descriptor strings: manufacturer, product */
191 snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
192 init_utsname()->sysname, init_utsname()->release,
193 gadget->name);
194 status = usb_string_ids_tab(cdev, strings_dev); 186 status = usb_string_ids_tab(cdev, strings_dev);
195 if (status < 0) 187 if (status < 0)
196 goto fail1; 188 goto fail1;
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index f3689e1bf4b2..c7066cd4c95a 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -28,9 +28,6 @@
28 * with the relevant device-wide data. 28 * with the relevant device-wide data.
29 */ 29 */
30 30
31static char composite_manufacturer[50];
32
33/*-------------------------------------------------------------------------*/
34/** 31/**
35 * next_ep_desc() - advance to the next EP descriptor 32 * next_ep_desc() - advance to the next EP descriptor
36 * @t: currect pointer within descriptor array 33 * @t: currect pointer within descriptor array
@@ -860,7 +857,6 @@ static int get_string(struct usb_composite_dev *cdev,
860 struct usb_configuration *c; 857 struct usb_configuration *c;
861 struct usb_function *f; 858 struct usb_function *f;
862 int len; 859 int len;
863 const char *str;
864 860
865 /* Yes, not only is USB's I18N support probably more than most 861 /* Yes, not only is USB's I18N support probably more than most
866 * folk will ever care about ... also, it's all supported here. 862 * folk will ever care about ... also, it's all supported here.
@@ -900,21 +896,6 @@ static int get_string(struct usb_composite_dev *cdev,
900 return s->bLength; 896 return s->bLength;
901 } 897 }
902 898
903 /* Otherwise, look up and return a specified string. First
904 * check if the string has not been overridden.
905 */
906 if (cdev->manufacturer_override == id)
907 str = composite_manufacturer;
908 else
909 str = NULL;
910 if (str) {
911 struct usb_gadget_strings strings = {
912 .language = language,
913 .strings = &(struct usb_string) { 0xff, str }
914 };
915 return usb_gadget_get_string(&strings, 0xff, buf);
916 }
917
918 /* String IDs are device-scoped, so we look up each string 899 /* String IDs are device-scoped, so we look up each string
919 * table we're told about. These lookups are infrequent; 900 * table we're told about. These lookups are infrequent;
920 * simpler-is-better here. 901 * simpler-is-better here.
@@ -1367,23 +1348,11 @@ composite_unbind(struct usb_gadget *gadget)
1367 usb_ep_free_request(gadget->ep0, cdev->req); 1348 usb_ep_free_request(gadget->ep0, cdev->req);
1368 } 1349 }
1369 device_remove_file(&gadget->dev, &dev_attr_suspended); 1350 device_remove_file(&gadget->dev, &dev_attr_suspended);
1351 kfree(cdev->def_manufacturer);
1370 kfree(cdev); 1352 kfree(cdev);
1371 set_gadget_data(gadget, NULL); 1353 set_gadget_data(gadget, NULL);
1372} 1354}
1373 1355
1374static u8 override_id(struct usb_composite_dev *cdev, u8 *desc)
1375{
1376 if (!*desc) {
1377 int ret = usb_string_id(cdev);
1378 if (unlikely(ret < 0))
1379 WARNING(cdev, "failed to override string ID\n");
1380 else
1381 *desc = ret;
1382 }
1383
1384 return *desc;
1385}
1386
1387static void update_unchanged_dev_desc(struct usb_device_descriptor *new, 1356static void update_unchanged_dev_desc(struct usb_device_descriptor *new,
1388 const struct usb_device_descriptor *old) 1357 const struct usb_device_descriptor *old)
1389{ 1358{
@@ -1477,19 +1446,6 @@ static int composite_bind(struct usb_gadget *gadget,
1477 1446
1478 update_unchanged_dev_desc(&cdev->desc, composite->dev); 1447 update_unchanged_dev_desc(&cdev->desc, composite->dev);
1479 1448
1480 /* string overrides */
1481 if (!cdev->desc.iManufacturer) {
1482 snprintf(composite_manufacturer,
1483 sizeof composite_manufacturer,
1484 "%s %s with %s",
1485 init_utsname()->sysname,
1486 init_utsname()->release,
1487 gadget->name);
1488
1489 cdev->manufacturer_override =
1490 override_id(cdev, &cdev->desc.iManufacturer);
1491 }
1492
1493 /* has userspace failed to provide a serial number? */ 1449 /* has userspace failed to provide a serial number? */
1494 if (composite->needs_serial && !cdev->desc.iSerialNumber) 1450 if (composite->needs_serial && !cdev->desc.iSerialNumber)
1495 WARNING(cdev, "userspace failed to provide iSerialNumber\n"); 1451 WARNING(cdev, "userspace failed to provide iSerialNumber\n");
@@ -1665,6 +1621,22 @@ void usb_composite_setup_continue(struct usb_composite_dev *cdev)
1665 spin_unlock_irqrestore(&cdev->lock, flags); 1621 spin_unlock_irqrestore(&cdev->lock, flags);
1666} 1622}
1667 1623
1624static char *composite_default_mfr(struct usb_gadget *gadget)
1625{
1626 char *mfr;
1627 int len;
1628
1629 len = snprintf(NULL, 0, "%s %s with %s", init_utsname()->sysname,
1630 init_utsname()->release, gadget->name);
1631 len++;
1632 mfr = kmalloc(len, GFP_KERNEL);
1633 if (!mfr)
1634 return NULL;
1635 snprintf(mfr, len, "%s %s with %s", init_utsname()->sysname,
1636 init_utsname()->release, gadget->name);
1637 return mfr;
1638}
1639
1668void usb_composite_overwrite_options(struct usb_composite_dev *cdev, 1640void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
1669 struct usb_composite_overwrite *covr) 1641 struct usb_composite_overwrite *covr)
1670{ 1642{
@@ -1688,6 +1660,11 @@ void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
1688 if (covr->manufacturer) { 1660 if (covr->manufacturer) {
1689 desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id; 1661 desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
1690 dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr->manufacturer; 1662 dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr->manufacturer;
1663
1664 } else if (!strlen(dev_str[USB_GADGET_MANUFACTURER_IDX].s)) {
1665 desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
1666 cdev->def_manufacturer = composite_default_mfr(cdev->gadget);
1667 dev_str[USB_GADGET_MANUFACTURER_IDX].s = cdev->def_manufacturer;
1691 } 1668 }
1692 1669
1693 if (covr->product) { 1670 if (covr->product) {
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index dd5e00d207fe..a5c272067625 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -14,8 +14,6 @@
14/* #define VERBOSE_DEBUG */ 14/* #define VERBOSE_DEBUG */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/utsname.h>
18
19 17
20#if defined USB_ETH_RNDIS 18#if defined USB_ETH_RNDIS
21# undef USB_ETH_RNDIS 19# undef USB_ETH_RNDIS
@@ -193,11 +191,8 @@ static const struct usb_descriptor_header *otg_desc[] = {
193 NULL, 191 NULL,
194}; 192};
195 193
196/* string IDs are assigned dynamically */
197static char manufacturer[50];
198
199static struct usb_string strings_dev[] = { 194static struct usb_string strings_dev[] = {
200 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, 195 [USB_GADGET_MANUFACTURER_IDX].s = "",
201 [USB_GADGET_PRODUCT_IDX].s = PREFIX DRIVER_DESC, 196 [USB_GADGET_PRODUCT_IDX].s = PREFIX DRIVER_DESC,
202 [USB_GADGET_SERIAL_IDX].s = "", 197 [USB_GADGET_SERIAL_IDX].s = "",
203 { } /* end of list */ 198 { } /* end of list */
@@ -333,15 +328,10 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
333 cpu_to_le16(0x0300 | 0x0099); 328 cpu_to_le16(0x0300 | 0x0099);
334 } 329 }
335 330
336
337 /* Allocate string descriptor numbers ... note that string 331 /* Allocate string descriptor numbers ... note that string
338 * contents can be overridden by the composite_dev glue. 332 * contents can be overridden by the composite_dev glue.
339 */ 333 */
340 334
341 /* device descriptor strings: manufacturer, product */
342 snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
343 init_utsname()->sysname, init_utsname()->release,
344 gadget->name);
345 status = usb_string_ids_tab(cdev, strings_dev); 335 status = usb_string_ids_tab(cdev, strings_dev);
346 if (status < 0) 336 if (status < 0)
347 goto fail; 337 goto fail;
diff --git a/drivers/usb/gadget/f_hid.c b/drivers/usb/gadget/f_hid.c
index 16a8b1c15c62..77dbca099bcb 100644
--- a/drivers/usb/gadget/f_hid.c
+++ b/drivers/usb/gadget/f_hid.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/utsname.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <linux/hid.h> 14#include <linux/hid.h>
16#include <linux/cdev.h> 15#include <linux/cdev.h>
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 4f1142efa6d1..11150960d88b 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -213,7 +213,6 @@
213#include <linux/spinlock.h> 213#include <linux/spinlock.h>
214#include <linux/string.h> 214#include <linux/string.h>
215#include <linux/freezer.h> 215#include <linux/freezer.h>
216#include <linux/utsname.h>
217 216
218#include <linux/usb/ch9.h> 217#include <linux/usb/ch9.h>
219#include <linux/usb/gadget.h> 218#include <linux/usb/gadget.h>
diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c
index 2f7e8f2930cc..8ed1259fe80d 100644
--- a/drivers/usb/gadget/f_midi.c
+++ b/drivers/usb/gadget/f_midi.c
@@ -21,7 +21,6 @@
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/utsname.h>
25#include <linux/device.h> 24#include <linux/device.h>
26 25
27#include <sound/core.h> 26#include <sound/core.h>
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index eaaed199e453..9e62c20fb5bc 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -13,7 +13,6 @@
13#define pr_fmt(fmt) "g_ffs: " fmt 13#define pr_fmt(fmt) "g_ffs: " fmt
14 14
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/utsname.h>
17 16
18/* 17/*
19 * kbuild is not very cooperative with respect to linking separately 18 * kbuild is not very cooperative with respect to linking separately
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index 2ee3a74056c9..59621ef7657d 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -22,7 +22,6 @@
22 22
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/utsname.h>
26#include <linux/module.h> 25#include <linux/module.h>
27#include <linux/device.h> 26#include <linux/device.h>
28 27
diff --git a/drivers/usb/gadget/hid.c b/drivers/usb/gadget/hid.c
index 16caf50e916d..0e2e357cc59e 100644
--- a/drivers/usb/gadget/hid.c
+++ b/drivers/usb/gadget/hid.c
@@ -91,10 +91,8 @@ static const struct usb_descriptor_header *otg_desc[] = {
91 91
92 92
93/* string IDs are assigned dynamically */ 93/* string IDs are assigned dynamically */
94static char manufacturer[50];
95
96static struct usb_string strings_dev[] = { 94static struct usb_string strings_dev[] = {
97 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, 95 [USB_GADGET_MANUFACTURER_IDX].s = "",
98 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, 96 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
99 [USB_GADGET_SERIAL_IDX].s = "", 97 [USB_GADGET_SERIAL_IDX].s = "",
100 { } /* end of list */ 98 { } /* end of list */
@@ -165,16 +163,10 @@ static int __init hid_bind(struct usb_composite_dev *cdev)
165 else 163 else
166 device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099); 164 device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099);
167 165
168
169 /* Allocate string descriptor numbers ... note that string 166 /* Allocate string descriptor numbers ... note that string
170 * contents can be overridden by the composite_dev glue. 167 * contents can be overridden by the composite_dev glue.
171 */ 168 */
172 169
173 /* device descriptor strings: manufacturer, product */
174 snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
175 init_utsname()->sysname, init_utsname()->release,
176 gadget->name);
177
178 status = usb_string_ids_tab(cdev, strings_dev); 170 status = usb_string_ids_tab(cdev, strings_dev);
179 if (status < 0) 171 if (status < 0)
180 return status; 172 return status;
diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c
index 50da3c88cb06..9eb2be685803 100644
--- a/drivers/usb/gadget/mass_storage.c
+++ b/drivers/usb/gadget/mass_storage.c
@@ -29,10 +29,8 @@
29 29
30 30
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/utsname.h>
33#include <linux/usb/ch9.h> 32#include <linux/usb/ch9.h>
34 33
35
36/*-------------------------------------------------------------------------*/ 34/*-------------------------------------------------------------------------*/
37 35
38#define DRIVER_DESC "Mass Storage Gadget" 36#define DRIVER_DESC "Mass Storage Gadget"
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index c158706b5ab0..5bc5d96beaac 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -14,10 +14,8 @@
14 14
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/utsname.h>
18#include <linux/module.h> 17#include <linux/module.h>
19 18
20
21#if defined USB_ETH_RNDIS 19#if defined USB_ETH_RNDIS
22# undef USB_ETH_RNDIS 20# undef USB_ETH_RNDIS
23#endif 21#endif
diff --git a/drivers/usb/gadget/ncm.c b/drivers/usb/gadget/ncm.c
index 1a26452ce4ca..343f3d364ef8 100644
--- a/drivers/usb/gadget/ncm.c
+++ b/drivers/usb/gadget/ncm.c
@@ -20,8 +20,6 @@
20/* #define VERBOSE_DEBUG */ 20/* #define VERBOSE_DEBUG */
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/utsname.h>
24
25 23
26#include "u_ether.h" 24#include "u_ether.h"
27 25
@@ -95,12 +93,9 @@ static const struct usb_descriptor_header *otg_desc[] = {
95 NULL, 93 NULL,
96}; 94};
97 95
98
99/* string IDs are assigned dynamically */ 96/* string IDs are assigned dynamically */
100static char manufacturer[50];
101
102static struct usb_string strings_dev[] = { 97static struct usb_string strings_dev[] = {
103 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, 98 [USB_GADGET_MANUFACTURER_IDX].s = "",
104 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, 99 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
105 [USB_GADGET_SERIAL_IDX].s = "", 100 [USB_GADGET_SERIAL_IDX].s = "",
106 { } /* end of list */ 101 { } /* end of list */
@@ -169,15 +164,10 @@ static int __init gncm_bind(struct usb_composite_dev *cdev)
169 cpu_to_le16(0x0300 | 0x0099); 164 cpu_to_le16(0x0300 | 0x0099);
170 } 165 }
171 166
172
173 /* Allocate string descriptor numbers ... note that string 167 /* Allocate string descriptor numbers ... note that string
174 * contents can be overridden by the composite_dev glue. 168 * contents can be overridden by the composite_dev glue.
175 */ 169 */
176 170
177 /* device descriptor strings: manufacturer, product */
178 snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
179 init_utsname()->sysname, init_utsname()->release,
180 gadget->name);
181 status = usb_string_ids_tab(cdev, strings_dev); 171 status = usb_string_ids_tab(cdev, strings_dev);
182 if (status < 0) 172 if (status < 0)
183 goto fail; 173 goto fail;
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index 34b97f12b7da..465766e41442 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -16,7 +16,6 @@
16 */ 16 */
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/utsname.h>
20#include <linux/device.h> 19#include <linux/device.h>
21 20
22#include "u_serial.h" 21#include "u_serial.h"
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 3321a9df4862..9bd994203d3d 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -22,7 +22,6 @@
22#include <linux/timer.h> 22#include <linux/timer.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/utsname.h>
26#include <linux/device.h> 25#include <linux/device.h>
27#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
28#include <linux/fs.h> 27#include <linux/fs.h>
@@ -237,7 +236,6 @@ static const struct usb_descriptor_header *otg_desc[] = {
237 236
238/* descriptors that are built on-demand */ 237/* descriptors that are built on-demand */
239 238
240static char manufacturer [50];
241static char product_desc [40] = DRIVER_DESC; 239static char product_desc [40] = DRIVER_DESC;
242static char serial_num [40] = "1"; 240static char serial_num [40] = "1";
243static char pnp_string [1024] = 241static char pnp_string [1024] =
@@ -245,7 +243,7 @@ static char pnp_string [1024] =
245 243
246/* static strings, in UTF-8 */ 244/* static strings, in UTF-8 */
247static struct usb_string strings [] = { 245static struct usb_string strings [] = {
248 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, 246 [USB_GADGET_MANUFACTURER_IDX].s = "",
249 [USB_GADGET_PRODUCT_IDX].s = product_desc, 247 [USB_GADGET_PRODUCT_IDX].s = product_desc,
250 [USB_GADGET_SERIAL_IDX].s = serial_num, 248 [USB_GADGET_SERIAL_IDX].s = serial_num,
251 { } /* end of list */ 249 { } /* end of list */
@@ -1165,10 +1163,6 @@ static int __init printer_bind_config(struct usb_configuration *c)
1165 device_desc.bcdDevice = 1163 device_desc.bcdDevice =
1166 cpu_to_le16(0xFFFF); 1164 cpu_to_le16(0xFFFF);
1167 } 1165 }
1168 snprintf(manufacturer, sizeof(manufacturer), "%s %s with %s",
1169 init_utsname()->sysname, init_utsname()->release,
1170 gadget->name);
1171
1172 if (iPNPstring) 1166 if (iPNPstring)
1173 strlcpy(&pnp_string[2], iPNPstring, (sizeof pnp_string)-2); 1167 strlcpy(&pnp_string[2], iPNPstring, (sizeof pnp_string)-2);
1174 1168
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 768a38e896f7..bf12d55cd07b 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/utsname.h>
15#include <linux/device.h> 14#include <linux/device.h>
16#include <linux/tty.h> 15#include <linux/tty.h>
17#include <linux/tty_flip.h> 16#include <linux/tty_flip.h>
@@ -61,10 +60,8 @@ USB_GADGET_COMPOSITE_OPTIONS();
61 60
62#define STRING_DESCRIPTION_IDX USB_GADGET_FIRST_AVAIL_IDX 61#define STRING_DESCRIPTION_IDX USB_GADGET_FIRST_AVAIL_IDX
63 62
64static char manufacturer[50];
65
66static struct usb_string strings_dev[] = { 63static struct usb_string strings_dev[] = {
67 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, 64 [USB_GADGET_MANUFACTURER_IDX].s = "",
68 [USB_GADGET_PRODUCT_IDX].s = GS_VERSION_NAME, 65 [USB_GADGET_PRODUCT_IDX].s = GS_VERSION_NAME,
69 [USB_GADGET_SERIAL_IDX].s = "", 66 [USB_GADGET_SERIAL_IDX].s = "",
70 [STRING_DESCRIPTION_IDX].s = NULL /* updated; f(use_acm) */, 67 [STRING_DESCRIPTION_IDX].s = NULL /* updated; f(use_acm) */,
@@ -171,10 +168,6 @@ static int __init gs_bind(struct usb_composite_dev *cdev)
171 * contents can be overridden by the composite_dev glue. 168 * contents can be overridden by the composite_dev glue.
172 */ 169 */
173 170
174 /* device description: manufacturer, product */
175 snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
176 init_utsname()->sysname, init_utsname()->release,
177 gadget->name);
178 status = usb_string_ids_tab(cdev, strings_dev); 171 status = usb_string_ids_tab(cdev, strings_dev);
179 if (status < 0) 172 if (status < 0)
180 goto fail; 173 goto fail;
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index ee769c45498b..a837f3af2047 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -42,7 +42,6 @@
42 42
43#include <linux/kernel.h> 43#include <linux/kernel.h>
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/utsname.h>
46#include <linux/device.h> 45#include <linux/device.h>
47 46
48#include "g_zero.h" 47#include "g_zero.h"
@@ -139,13 +138,11 @@ const struct usb_descriptor_header *otg_desc[] = {
139#endif 138#endif
140 139
141/* string IDs are assigned dynamically */ 140/* string IDs are assigned dynamically */
142static char manufacturer[50];
143
144/* default serial number takes at least two packets */ 141/* default serial number takes at least two packets */
145static char serial[] = "0123456789.0123456789.0123456789"; 142static char serial[] = "0123456789.0123456789.0123456789";
146 143
147static struct usb_string strings_dev[] = { 144static struct usb_string strings_dev[] = {
148 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, 145 [USB_GADGET_MANUFACTURER_IDX].s = "",
149 [USB_GADGET_PRODUCT_IDX].s = longname, 146 [USB_GADGET_PRODUCT_IDX].s = longname,
150 [USB_GADGET_SERIAL_IDX].s = serial, 147 [USB_GADGET_SERIAL_IDX].s = serial,
151 { } /* end of list */ 148 { } /* end of list */
@@ -305,10 +302,6 @@ static int __init zero_bind(struct usb_composite_dev *cdev)
305 302
306 INFO(cdev, "%s, version: " DRIVER_VERSION "\n", longname); 303 INFO(cdev, "%s, version: " DRIVER_VERSION "\n", longname);
307 304
308 snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
309 init_utsname()->sysname, init_utsname()->release,
310 gadget->name);
311
312 return 0; 305 return 0;
313} 306}
314 307