aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-08-12 11:43:55 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:21:26 -0400
commitc9bfff9c98671ad50e4abbfe1ab606a9957f7539 (patch)
tree68ca78391c78bde1a82000e34eec70866f5c956e /drivers/usb/gadget/composite.c
parent07a18bd716ed5dea336429404b132568cfaaef95 (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>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index c531a7e05f1e..5e2bd7428424 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 */
487int usb_add_config(struct usb_composite_dev *cdev, 488int 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);