diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-08-12 11:43:55 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:21:26 -0400 |
commit | c9bfff9c98671ad50e4abbfe1ab606a9957f7539 (patch) | |
tree | 68ca78391c78bde1a82000e34eec70866f5c956e | |
parent | 07a18bd716ed5dea336429404b132568cfaaef95 (diff) |
usb gadget: don't save bind callback in struct usb_configuration
The bind function is most of the time only called at init time so there
is no need to save a pointer to it in the configuration structure.
This fixes many section mismatches reported by modpost.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[m.nazarewicz@samsung.com: updated for -next]
Signed-off-by: Michał Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/gadget/audio.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/cdc2.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/composite.c | 14 | ||||
-rw-r--r-- | drivers/usb/gadget/ether.c | 7 | ||||
-rw-r--r-- | drivers/usb/gadget/f_loopback.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/f_sourcesink.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/g_ffs.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/hid.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/mass_storage.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/multi.c | 10 | ||||
-rw-r--r-- | drivers/usb/gadget/nokia.c | 8 | ||||
-rw-r--r-- | drivers/usb/gadget/serial.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/webcam.c | 4 | ||||
-rw-r--r-- | include/linux/usb/composite.h | 8 |
14 files changed, 33 insertions, 43 deletions
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 5a65fbb4e20..93b999e49ef 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c | |||
@@ -105,7 +105,6 @@ static int __init audio_do_config(struct usb_configuration *c) | |||
105 | 105 | ||
106 | static struct usb_configuration audio_config_driver = { | 106 | static struct usb_configuration audio_config_driver = { |
107 | .label = DRIVER_DESC, | 107 | .label = DRIVER_DESC, |
108 | .bind = audio_do_config, | ||
109 | .bConfigurationValue = 1, | 108 | .bConfigurationValue = 1, |
110 | /* .iConfiguration = DYNAMIC */ | 109 | /* .iConfiguration = DYNAMIC */ |
111 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 110 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
@@ -145,7 +144,7 @@ static int __init audio_bind(struct usb_composite_dev *cdev) | |||
145 | strings_dev[STRING_PRODUCT_IDX].id = status; | 144 | strings_dev[STRING_PRODUCT_IDX].id = status; |
146 | device_desc.iProduct = status; | 145 | device_desc.iProduct = status; |
147 | 146 | ||
148 | status = usb_add_config(cdev, &audio_config_driver); | 147 | status = usb_add_config(cdev, &audio_config_driver, audio_do_config); |
149 | if (status < 0) | 148 | if (status < 0) |
150 | goto fail; | 149 | goto fail; |
151 | 150 | ||
diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index 1f2a9b1e4f2..2720ab07ef1 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c | |||
@@ -151,7 +151,6 @@ static int __init cdc_do_config(struct usb_configuration *c) | |||
151 | 151 | ||
152 | static struct usb_configuration cdc_config_driver = { | 152 | static struct usb_configuration cdc_config_driver = { |
153 | .label = "CDC Composite (ECM + ACM)", | 153 | .label = "CDC Composite (ECM + ACM)", |
154 | .bind = cdc_do_config, | ||
155 | .bConfigurationValue = 1, | 154 | .bConfigurationValue = 1, |
156 | /* .iConfiguration = DYNAMIC */ | 155 | /* .iConfiguration = DYNAMIC */ |
157 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 156 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
@@ -218,7 +217,7 @@ static int __init cdc_bind(struct usb_composite_dev *cdev) | |||
218 | device_desc.iProduct = status; | 217 | device_desc.iProduct = status; |
219 | 218 | ||
220 | /* register our configuration */ | 219 | /* register our configuration */ |
221 | status = usb_add_config(cdev, &cdc_config_driver); | 220 | status = usb_add_config(cdev, &cdc_config_driver, cdc_do_config); |
222 | if (status < 0) | 221 | if (status < 0) |
223 | goto fail1; | 222 | goto fail1; |
224 | 223 | ||
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index c531a7e05f1..5e2bd742842 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -474,18 +474,20 @@ done: | |||
474 | * usb_add_config() - add a configuration to a device. | 474 | * usb_add_config() - add a configuration to a device. |
475 | * @cdev: wraps the USB gadget | 475 | * @cdev: wraps the USB gadget |
476 | * @config: the configuration, with bConfigurationValue assigned | 476 | * @config: the configuration, with bConfigurationValue assigned |
477 | * @bind: the configuration's bind function | ||
477 | * Context: single threaded during gadget setup | 478 | * Context: single threaded during gadget setup |
478 | * | 479 | * |
479 | * One of the main tasks of a composite driver's bind() routine is to | 480 | * One of the main tasks of a composite @bind() routine is to |
480 | * add each of the configurations it supports, using this routine. | 481 | * add each of the configurations it supports, using this routine. |
481 | * | 482 | * |
482 | * This function returns the value of the configuration's bind(), which | 483 | * This function returns the value of the configuration's @bind(), which |
483 | * is zero for success else a negative errno value. Binding configurations | 484 | * is zero for success else a negative errno value. Binding configurations |
484 | * assigns global resources including string IDs, and per-configuration | 485 | * assigns global resources including string IDs, and per-configuration |
485 | * resources such as interface IDs and endpoints. | 486 | * resources such as interface IDs and endpoints. |
486 | */ | 487 | */ |
487 | int usb_add_config(struct usb_composite_dev *cdev, | 488 | int usb_add_config(struct usb_composite_dev *cdev, |
488 | struct usb_configuration *config) | 489 | struct usb_configuration *config, |
490 | int (*bind)(struct usb_configuration *)) | ||
489 | { | 491 | { |
490 | int status = -EINVAL; | 492 | int status = -EINVAL; |
491 | struct usb_configuration *c; | 493 | struct usb_configuration *c; |
@@ -494,7 +496,7 @@ int usb_add_config(struct usb_composite_dev *cdev, | |||
494 | config->bConfigurationValue, | 496 | config->bConfigurationValue, |
495 | config->label, config); | 497 | config->label, config); |
496 | 498 | ||
497 | if (!config->bConfigurationValue || !config->bind) | 499 | if (!config->bConfigurationValue || !bind) |
498 | goto done; | 500 | goto done; |
499 | 501 | ||
500 | /* Prevent duplicate configuration identifiers */ | 502 | /* Prevent duplicate configuration identifiers */ |
@@ -511,7 +513,7 @@ int usb_add_config(struct usb_composite_dev *cdev, | |||
511 | INIT_LIST_HEAD(&config->functions); | 513 | INIT_LIST_HEAD(&config->functions); |
512 | config->next_interface_id = 0; | 514 | config->next_interface_id = 0; |
513 | 515 | ||
514 | status = config->bind(config); | 516 | status = bind(config); |
515 | if (status < 0) { | 517 | if (status < 0) { |
516 | list_del(&config->list); | 518 | list_del(&config->list); |
517 | config->cdev = NULL; | 519 | config->cdev = NULL; |
@@ -537,7 +539,7 @@ int usb_add_config(struct usb_composite_dev *cdev, | |||
537 | } | 539 | } |
538 | } | 540 | } |
539 | 541 | ||
540 | /* set_alt(), or next config->bind(), sets up | 542 | /* set_alt(), or next bind(), sets up |
541 | * ep->driver_data as needed. | 543 | * ep->driver_data as needed. |
542 | */ | 544 | */ |
543 | usb_ep_autoconfig_reset(cdev->gadget); | 545 | usb_ep_autoconfig_reset(cdev->gadget); |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 33076bca993..1690c9d6825 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -251,7 +251,6 @@ static int __init rndis_do_config(struct usb_configuration *c) | |||
251 | 251 | ||
252 | static struct usb_configuration rndis_config_driver = { | 252 | static struct usb_configuration rndis_config_driver = { |
253 | .label = "RNDIS", | 253 | .label = "RNDIS", |
254 | .bind = rndis_do_config, | ||
255 | .bConfigurationValue = 2, | 254 | .bConfigurationValue = 2, |
256 | /* .iConfiguration = DYNAMIC */ | 255 | /* .iConfiguration = DYNAMIC */ |
257 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 256 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
@@ -289,7 +288,6 @@ static int __init eth_do_config(struct usb_configuration *c) | |||
289 | 288 | ||
290 | static struct usb_configuration eth_config_driver = { | 289 | static struct usb_configuration eth_config_driver = { |
291 | /* .label = f(hardware) */ | 290 | /* .label = f(hardware) */ |
292 | .bind = eth_do_config, | ||
293 | .bConfigurationValue = 1, | 291 | .bConfigurationValue = 1, |
294 | /* .iConfiguration = DYNAMIC */ | 292 | /* .iConfiguration = DYNAMIC */ |
295 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 293 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
@@ -373,12 +371,13 @@ static int __init eth_bind(struct usb_composite_dev *cdev) | |||
373 | 371 | ||
374 | /* register our configuration(s); RNDIS first, if it's used */ | 372 | /* register our configuration(s); RNDIS first, if it's used */ |
375 | if (has_rndis()) { | 373 | if (has_rndis()) { |
376 | status = usb_add_config(cdev, &rndis_config_driver); | 374 | status = usb_add_config(cdev, &rndis_config_driver, |
375 | rndis_do_config); | ||
377 | if (status < 0) | 376 | if (status < 0) |
378 | goto fail; | 377 | goto fail; |
379 | } | 378 | } |
380 | 379 | ||
381 | status = usb_add_config(cdev, ð_config_driver); | 380 | status = usb_add_config(cdev, ð_config_driver, eth_do_config); |
382 | if (status < 0) | 381 | if (status < 0) |
383 | goto fail; | 382 | goto fail; |
384 | 383 | ||
diff --git a/drivers/usb/gadget/f_loopback.c b/drivers/usb/gadget/f_loopback.c index e91d1b16d9b..b37960f9e75 100644 --- a/drivers/usb/gadget/f_loopback.c +++ b/drivers/usb/gadget/f_loopback.c | |||
@@ -349,7 +349,6 @@ static int __init loopback_bind_config(struct usb_configuration *c) | |||
349 | static struct usb_configuration loopback_driver = { | 349 | static struct usb_configuration loopback_driver = { |
350 | .label = "loopback", | 350 | .label = "loopback", |
351 | .strings = loopback_strings, | 351 | .strings = loopback_strings, |
352 | .bind = loopback_bind_config, | ||
353 | .bConfigurationValue = 2, | 352 | .bConfigurationValue = 2, |
354 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 353 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
355 | /* .iConfiguration = DYNAMIC */ | 354 | /* .iConfiguration = DYNAMIC */ |
@@ -382,5 +381,5 @@ int __init loopback_add(struct usb_composite_dev *cdev, bool autoresume) | |||
382 | loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; | 381 | loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; |
383 | } | 382 | } |
384 | 383 | ||
385 | return usb_add_config(cdev, &loopback_driver); | 384 | return usb_add_config(cdev, &loopback_driver, loopback_bind_config); |
386 | } | 385 | } |
diff --git a/drivers/usb/gadget/f_sourcesink.c b/drivers/usb/gadget/f_sourcesink.c index 6d3cc443d91..e403a534dd5 100644 --- a/drivers/usb/gadget/f_sourcesink.c +++ b/drivers/usb/gadget/f_sourcesink.c | |||
@@ -498,7 +498,6 @@ unknown: | |||
498 | static struct usb_configuration sourcesink_driver = { | 498 | static struct usb_configuration sourcesink_driver = { |
499 | .label = "source/sink", | 499 | .label = "source/sink", |
500 | .strings = sourcesink_strings, | 500 | .strings = sourcesink_strings, |
501 | .bind = sourcesink_bind_config, | ||
502 | .setup = sourcesink_setup, | 501 | .setup = sourcesink_setup, |
503 | .bConfigurationValue = 3, | 502 | .bConfigurationValue = 3, |
504 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 503 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
@@ -532,5 +531,5 @@ int __init sourcesink_add(struct usb_composite_dev *cdev, bool autoresume) | |||
532 | sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; | 531 | sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; |
533 | } | 532 | } |
534 | 533 | ||
535 | return usb_add_config(cdev, &sourcesink_driver); | 534 | return usb_add_config(cdev, &sourcesink_driver, sourcesink_bind_config); |
536 | } | 535 | } |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 9fcb1587950..af75e362084 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -234,11 +234,10 @@ static int gfs_bind(struct usb_composite_dev *cdev) | |||
234 | 234 | ||
235 | c->c.label = gfs_strings[i].s; | 235 | c->c.label = gfs_strings[i].s; |
236 | c->c.iConfiguration = gfs_strings[i].id; | 236 | c->c.iConfiguration = gfs_strings[i].id; |
237 | c->c.bind = gfs_do_config; | ||
238 | c->c.bConfigurationValue = 1 + i; | 237 | c->c.bConfigurationValue = 1 + i; |
239 | c->c.bmAttributes = USB_CONFIG_ATT_SELFPOWER; | 238 | c->c.bmAttributes = USB_CONFIG_ATT_SELFPOWER; |
240 | 239 | ||
241 | ret = usb_add_config(cdev, &c->c); | 240 | ret = usb_add_config(cdev, &c->c, gfs_do_config); |
242 | if (unlikely(ret < 0)) | 241 | if (unlikely(ret < 0)) |
243 | goto error_unbind; | 242 | goto error_unbind; |
244 | } | 243 | } |
diff --git a/drivers/usb/gadget/hid.c b/drivers/usb/gadget/hid.c index 77f495212fb..2523e54097b 100644 --- a/drivers/usb/gadget/hid.c +++ b/drivers/usb/gadget/hid.c | |||
@@ -148,7 +148,6 @@ static int __init do_config(struct usb_configuration *c) | |||
148 | 148 | ||
149 | static struct usb_configuration config_driver = { | 149 | static struct usb_configuration config_driver = { |
150 | .label = "HID Gadget", | 150 | .label = "HID Gadget", |
151 | .bind = do_config, | ||
152 | .bConfigurationValue = 1, | 151 | .bConfigurationValue = 1, |
153 | /* .iConfiguration = DYNAMIC */ | 152 | /* .iConfiguration = DYNAMIC */ |
154 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 153 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
@@ -201,7 +200,7 @@ static int __init hid_bind(struct usb_composite_dev *cdev) | |||
201 | device_desc.iProduct = status; | 200 | device_desc.iProduct = status; |
202 | 201 | ||
203 | /* register our configuration */ | 202 | /* register our configuration */ |
204 | status = usb_add_config(cdev, &config_driver); | 203 | status = usb_add_config(cdev, &config_driver, do_config); |
205 | if (status < 0) | 204 | if (status < 0) |
206 | return status; | 205 | return status; |
207 | 206 | ||
diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c index a5e4a777d92..0769179dbdb 100644 --- a/drivers/usb/gadget/mass_storage.c +++ b/drivers/usb/gadget/mass_storage.c | |||
@@ -141,7 +141,6 @@ static int __init msg_do_config(struct usb_configuration *c) | |||
141 | 141 | ||
142 | static struct usb_configuration msg_config_driver = { | 142 | static struct usb_configuration msg_config_driver = { |
143 | .label = "Linux File-Backed Storage", | 143 | .label = "Linux File-Backed Storage", |
144 | .bind = msg_do_config, | ||
145 | .bConfigurationValue = 1, | 144 | .bConfigurationValue = 1, |
146 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 145 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
147 | }; | 146 | }; |
@@ -153,7 +152,7 @@ static int __init msg_bind(struct usb_composite_dev *cdev) | |||
153 | { | 152 | { |
154 | int status; | 153 | int status; |
155 | 154 | ||
156 | status = usb_add_config(cdev, &msg_config_driver); | 155 | status = usb_add_config(cdev, &msg_config_driver, msg_do_config); |
157 | if (status < 0) | 156 | if (status < 0) |
158 | return status; | 157 | return status; |
159 | 158 | ||
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index 91170a02a9a..d9feced348e 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c | |||
@@ -164,7 +164,7 @@ static u8 hostaddr[ETH_ALEN]; | |||
164 | 164 | ||
165 | #ifdef USB_ETH_RNDIS | 165 | #ifdef USB_ETH_RNDIS |
166 | 166 | ||
167 | static __ref int rndis_do_config(struct usb_configuration *c) | 167 | static __init int rndis_do_config(struct usb_configuration *c) |
168 | { | 168 | { |
169 | int ret; | 169 | int ret; |
170 | 170 | ||
@@ -191,7 +191,6 @@ static __ref int rndis_do_config(struct usb_configuration *c) | |||
191 | static int rndis_config_register(struct usb_composite_dev *cdev) | 191 | static int rndis_config_register(struct usb_composite_dev *cdev) |
192 | { | 192 | { |
193 | static struct usb_configuration config = { | 193 | static struct usb_configuration config = { |
194 | .bind = rndis_do_config, | ||
195 | .bConfigurationValue = MULTI_RNDIS_CONFIG_NUM, | 194 | .bConfigurationValue = MULTI_RNDIS_CONFIG_NUM, |
196 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 195 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
197 | }; | 196 | }; |
@@ -199,7 +198,7 @@ static int rndis_config_register(struct usb_composite_dev *cdev) | |||
199 | config.label = strings_dev[MULTI_STRING_RNDIS_CONFIG_IDX].s; | 198 | config.label = strings_dev[MULTI_STRING_RNDIS_CONFIG_IDX].s; |
200 | config.iConfiguration = strings_dev[MULTI_STRING_RNDIS_CONFIG_IDX].id; | 199 | config.iConfiguration = strings_dev[MULTI_STRING_RNDIS_CONFIG_IDX].id; |
201 | 200 | ||
202 | return usb_add_config(cdev, &config); | 201 | return usb_add_config(cdev, &config, rndis_do_config); |
203 | } | 202 | } |
204 | 203 | ||
205 | #else | 204 | #else |
@@ -216,7 +215,7 @@ static int rndis_config_register(struct usb_composite_dev *cdev) | |||
216 | 215 | ||
217 | #ifdef CONFIG_USB_G_MULTI_CDC | 216 | #ifdef CONFIG_USB_G_MULTI_CDC |
218 | 217 | ||
219 | static __ref int cdc_do_config(struct usb_configuration *c) | 218 | static __init int cdc_do_config(struct usb_configuration *c) |
220 | { | 219 | { |
221 | int ret; | 220 | int ret; |
222 | 221 | ||
@@ -243,7 +242,6 @@ static __ref int cdc_do_config(struct usb_configuration *c) | |||
243 | static int cdc_config_register(struct usb_composite_dev *cdev) | 242 | static int cdc_config_register(struct usb_composite_dev *cdev) |
244 | { | 243 | { |
245 | static struct usb_configuration config = { | 244 | static struct usb_configuration config = { |
246 | .bind = cdc_do_config, | ||
247 | .bConfigurationValue = MULTI_CDC_CONFIG_NUM, | 245 | .bConfigurationValue = MULTI_CDC_CONFIG_NUM, |
248 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 246 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
249 | }; | 247 | }; |
@@ -251,7 +249,7 @@ static int cdc_config_register(struct usb_composite_dev *cdev) | |||
251 | config.label = strings_dev[MULTI_STRING_CDC_CONFIG_IDX].s; | 249 | config.label = strings_dev[MULTI_STRING_CDC_CONFIG_IDX].s; |
252 | config.iConfiguration = strings_dev[MULTI_STRING_CDC_CONFIG_IDX].id; | 250 | config.iConfiguration = strings_dev[MULTI_STRING_CDC_CONFIG_IDX].id; |
253 | 251 | ||
254 | return usb_add_config(cdev, &config); | 252 | return usb_add_config(cdev, &config, cdc_do_config); |
255 | } | 253 | } |
256 | 254 | ||
257 | #else | 255 | #else |
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c index 8aec728882a..b5364f9d7cd 100644 --- a/drivers/usb/gadget/nokia.c +++ b/drivers/usb/gadget/nokia.c | |||
@@ -135,7 +135,6 @@ static int __init nokia_bind_config(struct usb_configuration *c) | |||
135 | 135 | ||
136 | static struct usb_configuration nokia_config_500ma_driver = { | 136 | static struct usb_configuration nokia_config_500ma_driver = { |
137 | .label = "Bus Powered", | 137 | .label = "Bus Powered", |
138 | .bind = nokia_bind_config, | ||
139 | .bConfigurationValue = 1, | 138 | .bConfigurationValue = 1, |
140 | /* .iConfiguration = DYNAMIC */ | 139 | /* .iConfiguration = DYNAMIC */ |
141 | .bmAttributes = USB_CONFIG_ATT_ONE, | 140 | .bmAttributes = USB_CONFIG_ATT_ONE, |
@@ -144,7 +143,6 @@ static struct usb_configuration nokia_config_500ma_driver = { | |||
144 | 143 | ||
145 | static struct usb_configuration nokia_config_100ma_driver = { | 144 | static struct usb_configuration nokia_config_100ma_driver = { |
146 | .label = "Self Powered", | 145 | .label = "Self Powered", |
147 | .bind = nokia_bind_config, | ||
148 | .bConfigurationValue = 2, | 146 | .bConfigurationValue = 2, |
149 | /* .iConfiguration = DYNAMIC */ | 147 | /* .iConfiguration = DYNAMIC */ |
150 | .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, | 148 | .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, |
@@ -206,11 +204,13 @@ static int __init nokia_bind(struct usb_composite_dev *cdev) | |||
206 | } | 204 | } |
207 | 205 | ||
208 | /* finaly register the configuration */ | 206 | /* finaly register the configuration */ |
209 | status = usb_add_config(cdev, &nokia_config_500ma_driver); | 207 | status = usb_add_config(cdev, &nokia_config_500ma_driver, |
208 | nokia_bind_config); | ||
210 | if (status < 0) | 209 | if (status < 0) |
211 | goto err_usb; | 210 | goto err_usb; |
212 | 211 | ||
213 | status = usb_add_config(cdev, &nokia_config_100ma_driver); | 212 | status = usb_add_config(cdev, &nokia_config_100ma_driver, |
213 | nokia_bind_config); | ||
214 | if (status < 0) | 214 | if (status < 0) |
215 | goto err_usb; | 215 | goto err_usb; |
216 | 216 | ||
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 0b81d7b741d..1ac57a973aa 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -155,7 +155,6 @@ static int __init serial_bind_config(struct usb_configuration *c) | |||
155 | 155 | ||
156 | static struct usb_configuration serial_config_driver = { | 156 | static struct usb_configuration serial_config_driver = { |
157 | /* .label = f(use_acm) */ | 157 | /* .label = f(use_acm) */ |
158 | .bind = serial_bind_config, | ||
159 | /* .bConfigurationValue = f(use_acm) */ | 158 | /* .bConfigurationValue = f(use_acm) */ |
160 | /* .iConfiguration = DYNAMIC */ | 159 | /* .iConfiguration = DYNAMIC */ |
161 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 160 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
@@ -225,7 +224,8 @@ static int __init gs_bind(struct usb_composite_dev *cdev) | |||
225 | } | 224 | } |
226 | 225 | ||
227 | /* register our configuration */ | 226 | /* register our configuration */ |
228 | status = usb_add_config(cdev, &serial_config_driver); | 227 | status = usb_add_config(cdev, &serial_config_driver, |
228 | serial_bind_config); | ||
229 | if (status < 0) | 229 | if (status < 0) |
230 | goto fail; | 230 | goto fail; |
231 | 231 | ||
diff --git a/drivers/usb/gadget/webcam.c b/drivers/usb/gadget/webcam.c index de65b8078e0..a5a0fdb808c 100644 --- a/drivers/usb/gadget/webcam.c +++ b/drivers/usb/gadget/webcam.c | |||
@@ -317,7 +317,6 @@ webcam_config_bind(struct usb_configuration *c) | |||
317 | 317 | ||
318 | static struct usb_configuration webcam_config_driver = { | 318 | static struct usb_configuration webcam_config_driver = { |
319 | .label = webcam_config_label, | 319 | .label = webcam_config_label, |
320 | .bind = webcam_config_bind, | ||
321 | .bConfigurationValue = 1, | 320 | .bConfigurationValue = 1, |
322 | .iConfiguration = 0, /* dynamic */ | 321 | .iConfiguration = 0, /* dynamic */ |
323 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | 322 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, |
@@ -354,7 +353,8 @@ webcam_bind(struct usb_composite_dev *cdev) | |||
354 | webcam_config_driver.iConfiguration = ret; | 353 | webcam_config_driver.iConfiguration = ret; |
355 | 354 | ||
356 | /* Register our configuration. */ | 355 | /* Register our configuration. */ |
357 | if ((ret = usb_add_config(cdev, &webcam_config_driver)) < 0) | 356 | if ((ret = usb_add_config(cdev, &webcam_config_driver, |
357 | webcam_config_bind)) < 0) | ||
358 | goto error; | 358 | goto error; |
359 | 359 | ||
360 | INFO(cdev, "Webcam Video Gadget\n"); | 360 | INFO(cdev, "Webcam Video Gadget\n"); |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index e28b6626802..3d29a7dcac2 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -161,8 +161,6 @@ ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs, | |||
161 | * and by language IDs provided in control requests. | 161 | * and by language IDs provided in control requests. |
162 | * @descriptors: Table of descriptors preceding all function descriptors. | 162 | * @descriptors: Table of descriptors preceding all function descriptors. |
163 | * Examples include OTG and vendor-specific descriptors. | 163 | * Examples include OTG and vendor-specific descriptors. |
164 | * @bind: Called from @usb_add_config() to allocate resources unique to this | ||
165 | * configuration and to call @usb_add_function() for each function used. | ||
166 | * @unbind: Reverses @bind; called as a side effect of unregistering the | 164 | * @unbind: Reverses @bind; called as a side effect of unregistering the |
167 | * driver which added this configuration. | 165 | * driver which added this configuration. |
168 | * @setup: Used to delegate control requests that aren't handled by standard | 166 | * @setup: Used to delegate control requests that aren't handled by standard |
@@ -207,8 +205,7 @@ struct usb_configuration { | |||
207 | * we can't restructure things to avoid mismatching... | 205 | * we can't restructure things to avoid mismatching... |
208 | */ | 206 | */ |
209 | 207 | ||
210 | /* configuration management: bind/unbind */ | 208 | /* configuration management: unbind/setup */ |
211 | int (*bind)(struct usb_configuration *); | ||
212 | void (*unbind)(struct usb_configuration *); | 209 | void (*unbind)(struct usb_configuration *); |
213 | int (*setup)(struct usb_configuration *, | 210 | int (*setup)(struct usb_configuration *, |
214 | const struct usb_ctrlrequest *); | 211 | const struct usb_ctrlrequest *); |
@@ -232,7 +229,8 @@ struct usb_configuration { | |||
232 | }; | 229 | }; |
233 | 230 | ||
234 | int usb_add_config(struct usb_composite_dev *, | 231 | int usb_add_config(struct usb_composite_dev *, |
235 | struct usb_configuration *); | 232 | struct usb_configuration *, |
233 | int (*)(struct usb_configuration *)); | ||
236 | 234 | ||
237 | /** | 235 | /** |
238 | * struct usb_composite_driver - groups configurations into a gadget | 236 | * struct usb_composite_driver - groups configurations into a gadget |