diff options
Diffstat (limited to 'drivers/usb/gadget/multi.c')
-rw-r--r-- | drivers/usb/gadget/multi.c | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index 795d76232167..d9feced348e3 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c | |||
@@ -74,8 +74,8 @@ MODULE_LICENSE("GPL"); | |||
74 | 74 | ||
75 | /***************************** Device Descriptor ****************************/ | 75 | /***************************** Device Descriptor ****************************/ |
76 | 76 | ||
77 | #define MULTI_VENDOR_NUM 0x0525 /* XXX NetChip */ | 77 | #define MULTI_VENDOR_NUM 0x1d6b /* Linux Foundation */ |
78 | #define MULTI_PRODUCT_NUM 0xa4ab /* XXX */ | 78 | #define MULTI_PRODUCT_NUM 0x0104 /* Multifunction Composite Gadget */ |
79 | 79 | ||
80 | 80 | ||
81 | enum { | 81 | enum { |
@@ -121,8 +121,6 @@ static const struct usb_descriptor_header *otg_desc[] = { | |||
121 | 121 | ||
122 | 122 | ||
123 | enum { | 123 | enum { |
124 | MULTI_STRING_MANUFACTURER_IDX, | ||
125 | MULTI_STRING_PRODUCT_IDX, | ||
126 | #ifdef CONFIG_USB_G_MULTI_RNDIS | 124 | #ifdef CONFIG_USB_G_MULTI_RNDIS |
127 | MULTI_STRING_RNDIS_CONFIG_IDX, | 125 | MULTI_STRING_RNDIS_CONFIG_IDX, |
128 | #endif | 126 | #endif |
@@ -131,11 +129,7 @@ enum { | |||
131 | #endif | 129 | #endif |
132 | }; | 130 | }; |
133 | 131 | ||
134 | static char manufacturer[50]; | ||
135 | |||
136 | static struct usb_string strings_dev[] = { | 132 | static struct usb_string strings_dev[] = { |
137 | [MULTI_STRING_MANUFACTURER_IDX].s = manufacturer, | ||
138 | [MULTI_STRING_PRODUCT_IDX].s = DRIVER_DESC, | ||
139 | #ifdef CONFIG_USB_G_MULTI_RNDIS | 133 | #ifdef CONFIG_USB_G_MULTI_RNDIS |
140 | [MULTI_STRING_RNDIS_CONFIG_IDX].s = "Multifunction with RNDIS", | 134 | [MULTI_STRING_RNDIS_CONFIG_IDX].s = "Multifunction with RNDIS", |
141 | #endif | 135 | #endif |
@@ -170,7 +164,7 @@ static u8 hostaddr[ETH_ALEN]; | |||
170 | 164 | ||
171 | #ifdef USB_ETH_RNDIS | 165 | #ifdef USB_ETH_RNDIS |
172 | 166 | ||
173 | static __ref int rndis_do_config(struct usb_configuration *c) | 167 | static __init int rndis_do_config(struct usb_configuration *c) |
174 | { | 168 | { |
175 | int ret; | 169 | int ret; |
176 | 170 | ||
@@ -197,7 +191,6 @@ static __ref int rndis_do_config(struct usb_configuration *c) | |||
197 | static int rndis_config_register(struct usb_composite_dev *cdev) | 191 | static int rndis_config_register(struct usb_composite_dev *cdev) |
198 | { | 192 | { |
199 | static struct usb_configuration config = { | 193 | static struct usb_configuration config = { |
200 | .bind = rndis_do_config, | ||
201 | .bConfigurationValue = MULTI_RNDIS_CONFIG_NUM, | 194 | .bConfigurationValue = MULTI_RNDIS_CONFIG_NUM, |
202 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 195 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
203 | }; | 196 | }; |
@@ -205,7 +198,7 @@ static int rndis_config_register(struct usb_composite_dev *cdev) | |||
205 | config.label = strings_dev[MULTI_STRING_RNDIS_CONFIG_IDX].s; | 198 | config.label = strings_dev[MULTI_STRING_RNDIS_CONFIG_IDX].s; |
206 | config.iConfiguration = strings_dev[MULTI_STRING_RNDIS_CONFIG_IDX].id; | 199 | config.iConfiguration = strings_dev[MULTI_STRING_RNDIS_CONFIG_IDX].id; |
207 | 200 | ||
208 | return usb_add_config(cdev, &config); | 201 | return usb_add_config(cdev, &config, rndis_do_config); |
209 | } | 202 | } |
210 | 203 | ||
211 | #else | 204 | #else |
@@ -222,7 +215,7 @@ static int rndis_config_register(struct usb_composite_dev *cdev) | |||
222 | 215 | ||
223 | #ifdef CONFIG_USB_G_MULTI_CDC | 216 | #ifdef CONFIG_USB_G_MULTI_CDC |
224 | 217 | ||
225 | static __ref int cdc_do_config(struct usb_configuration *c) | 218 | static __init int cdc_do_config(struct usb_configuration *c) |
226 | { | 219 | { |
227 | int ret; | 220 | int ret; |
228 | 221 | ||
@@ -249,7 +242,6 @@ static __ref int cdc_do_config(struct usb_configuration *c) | |||
249 | static int cdc_config_register(struct usb_composite_dev *cdev) | 242 | static int cdc_config_register(struct usb_composite_dev *cdev) |
250 | { | 243 | { |
251 | static struct usb_configuration config = { | 244 | static struct usb_configuration config = { |
252 | .bind = cdc_do_config, | ||
253 | .bConfigurationValue = MULTI_CDC_CONFIG_NUM, | 245 | .bConfigurationValue = MULTI_CDC_CONFIG_NUM, |
254 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 246 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
255 | }; | 247 | }; |
@@ -257,7 +249,7 @@ static int cdc_config_register(struct usb_composite_dev *cdev) | |||
257 | config.label = strings_dev[MULTI_STRING_CDC_CONFIG_IDX].s; | 249 | config.label = strings_dev[MULTI_STRING_CDC_CONFIG_IDX].s; |
258 | config.iConfiguration = strings_dev[MULTI_STRING_CDC_CONFIG_IDX].id; | 250 | config.iConfiguration = strings_dev[MULTI_STRING_CDC_CONFIG_IDX].id; |
259 | 251 | ||
260 | return usb_add_config(cdev, &config); | 252 | return usb_add_config(cdev, &config, cdc_do_config); |
261 | } | 253 | } |
262 | 254 | ||
263 | #else | 255 | #else |
@@ -314,20 +306,11 @@ static int __ref multi_bind(struct usb_composite_dev *cdev) | |||
314 | device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099); | 306 | device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099); |
315 | } | 307 | } |
316 | 308 | ||
317 | /* allocate string descriptor numbers */ | 309 | /* allocate string IDs */ |
318 | snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", | ||
319 | init_utsname()->sysname, init_utsname()->release, | ||
320 | gadget->name); | ||
321 | |||
322 | status = usb_string_ids_tab(cdev, strings_dev); | 310 | status = usb_string_ids_tab(cdev, strings_dev); |
323 | if (unlikely(status < 0)) | 311 | if (unlikely(status < 0)) |
324 | goto fail2; | 312 | goto fail2; |
325 | 313 | ||
326 | device_desc.iManufacturer = | ||
327 | strings_dev[MULTI_STRING_MANUFACTURER_IDX].id; | ||
328 | device_desc.iProduct = | ||
329 | strings_dev[MULTI_STRING_PRODUCT_IDX].id; | ||
330 | |||
331 | /* register configurations */ | 314 | /* register configurations */ |
332 | status = rndis_config_register(cdev); | 315 | status = rndis_config_register(cdev); |
333 | if (unlikely(status < 0)) | 316 | if (unlikely(status < 0)) |
@@ -368,14 +351,15 @@ static struct usb_composite_driver multi_driver = { | |||
368 | .name = "g_multi", | 351 | .name = "g_multi", |
369 | .dev = &device_desc, | 352 | .dev = &device_desc, |
370 | .strings = dev_strings, | 353 | .strings = dev_strings, |
371 | .bind = multi_bind, | ||
372 | .unbind = __exit_p(multi_unbind), | 354 | .unbind = __exit_p(multi_unbind), |
355 | .iProduct = DRIVER_DESC, | ||
356 | .needs_serial = 1, | ||
373 | }; | 357 | }; |
374 | 358 | ||
375 | 359 | ||
376 | static int __init multi_init(void) | 360 | static int __init multi_init(void) |
377 | { | 361 | { |
378 | return usb_composite_register(&multi_driver); | 362 | return usb_composite_probe(&multi_driver, multi_bind); |
379 | } | 363 | } |
380 | module_init(multi_init); | 364 | module_init(multi_init); |
381 | 365 | ||