aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-08-12 11:43:53 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:21:25 -0400
commitb0fca50f5a94a268ed02cfddf44448051ed9343f (patch)
treebc398947bcf6355f05ec33e4fea6a0b1927384ac /drivers
parente12995ec8f8d99f2a339541fc28998af2d60af0f (diff)
usb gadget: don't save bind callback in struct usb_gadget_driver
To accomplish this the function to register a gadget driver takes the bind function as a second argument. To make things clearer rename the function to resemble platform_driver_probe. This fixes many section mismatches like WARNING: drivers/usb/gadget/g_printer.o(.data+0xc): Section mismatch in reference from the variable printer_driver to the function .init.text:printer_bind() The variable printer_driver references the function __init printer_bind() All callers are fixed. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [m.nazarewicz@samsung.com: added dbgp] Signed-off-by: Michał Nazarewicz <m.nazarewicz@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/amd5536udc.c9
-rw-r--r--drivers/usb/gadget/at91_udc.c11
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c7
-rw-r--r--drivers/usb/gadget/ci13xxx_udc.c18
-rw-r--r--drivers/usb/gadget/composite.c3
-rw-r--r--drivers/usb/gadget/dbgp.c3
-rw-r--r--drivers/usb/gadget/dummy_hcd.c10
-rw-r--r--drivers/usb/gadget/file_storage.c3
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c12
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c10
-rw-r--r--drivers/usb/gadget/gmidi.c3
-rw-r--r--drivers/usb/gadget/goku_udc.c9
-rw-r--r--drivers/usb/gadget/imx_udc.c9
-rw-r--r--drivers/usb/gadget/inode.c6
-rw-r--r--drivers/usb/gadget/langwell_udc.c9
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c10
-rw-r--r--drivers/usb/gadget/m66592-udc.c9
-rw-r--r--drivers/usb/gadget/net2280.c10
-rw-r--r--drivers/usb/gadget/omap_udc.c10
-rw-r--r--drivers/usb/gadget/printer.c5
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c9
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c12
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c9
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c9
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c17
-rw-r--r--drivers/usb/musb/musb_gadget.c11
26 files changed, 120 insertions, 113 deletions
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index 731150d4b1d9..fadebfd53b47 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -1954,13 +1954,14 @@ static int setup_ep0(struct udc *dev)
1954} 1954}
1955 1955
1956/* Called by gadget driver to register itself */ 1956/* Called by gadget driver to register itself */
1957int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1957int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1958 int (*bind)(struct usb_gadget *))
1958{ 1959{
1959 struct udc *dev = udc; 1960 struct udc *dev = udc;
1960 int retval; 1961 int retval;
1961 u32 tmp; 1962 u32 tmp;
1962 1963
1963 if (!driver || !driver->bind || !driver->setup 1964 if (!driver || !bind || !driver->setup
1964 || driver->speed != USB_SPEED_HIGH) 1965 || driver->speed != USB_SPEED_HIGH)
1965 return -EINVAL; 1966 return -EINVAL;
1966 if (!dev) 1967 if (!dev)
@@ -1972,7 +1973,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1972 dev->driver = driver; 1973 dev->driver = driver;
1973 dev->gadget.dev.driver = &driver->driver; 1974 dev->gadget.dev.driver = &driver->driver;
1974 1975
1975 retval = driver->bind(&dev->gadget); 1976 retval = bind(&dev->gadget);
1976 1977
1977 /* Some gadget drivers use both ep0 directions. 1978 /* Some gadget drivers use both ep0 directions.
1978 * NOTE: to gadget driver, ep0 is just one endpoint... 1979 * NOTE: to gadget driver, ep0 is just one endpoint...
@@ -2000,7 +2001,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2000 2001
2001 return 0; 2002 return 0;
2002} 2003}
2003EXPORT_SYMBOL(usb_gadget_register_driver); 2004EXPORT_SYMBOL(usb_gadget_probe_driver);
2004 2005
2005/* shutdown requests and disconnect from gadget */ 2006/* shutdown requests and disconnect from gadget */
2006static void 2007static void
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 93ead19507b6..387e503b9d14 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1628,7 +1628,8 @@ static void at91_vbus_timer(unsigned long data)
1628 schedule_work(&udc->vbus_timer_work); 1628 schedule_work(&udc->vbus_timer_work);
1629} 1629}
1630 1630
1631int usb_gadget_register_driver (struct usb_gadget_driver *driver) 1631int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1632 int (*bind)(struct usb_gadget *))
1632{ 1633{
1633 struct at91_udc *udc = &controller; 1634 struct at91_udc *udc = &controller;
1634 int retval; 1635 int retval;
@@ -1636,7 +1637,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
1636 1637
1637 if (!driver 1638 if (!driver
1638 || driver->speed < USB_SPEED_FULL 1639 || driver->speed < USB_SPEED_FULL
1639 || !driver->bind 1640 || !bind
1640 || !driver->setup) { 1641 || !driver->setup) {
1641 DBG("bad parameter.\n"); 1642 DBG("bad parameter.\n");
1642 return -EINVAL; 1643 return -EINVAL;
@@ -1653,9 +1654,9 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
1653 udc->enabled = 1; 1654 udc->enabled = 1;
1654 udc->selfpowered = 1; 1655 udc->selfpowered = 1;
1655 1656
1656 retval = driver->bind(&udc->gadget); 1657 retval = bind(&udc->gadget);
1657 if (retval) { 1658 if (retval) {
1658 DBG("driver->bind() returned %d\n", retval); 1659 DBG("bind() returned %d\n", retval);
1659 udc->driver = NULL; 1660 udc->driver = NULL;
1660 udc->gadget.dev.driver = NULL; 1661 udc->gadget.dev.driver = NULL;
1661 dev_set_drvdata(&udc->gadget.dev, NULL); 1662 dev_set_drvdata(&udc->gadget.dev, NULL);
@@ -1671,7 +1672,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
1671 DBG("bound to %s\n", driver->driver.name); 1672 DBG("bound to %s\n", driver->driver.name);
1672 return 0; 1673 return 0;
1673} 1674}
1674EXPORT_SYMBOL (usb_gadget_register_driver); 1675EXPORT_SYMBOL(usb_gadget_probe_driver);
1675 1676
1676int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) 1677int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
1677{ 1678{
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index d623c7bda1f6..e4810c6a0b1f 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1789,7 +1789,8 @@ out:
1789 return IRQ_HANDLED; 1789 return IRQ_HANDLED;
1790} 1790}
1791 1791
1792int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1792int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1793 int (*bind)(struct usb_gadget *))
1793{ 1794{
1794 struct usba_udc *udc = &the_udc; 1795 struct usba_udc *udc = &the_udc;
1795 unsigned long flags; 1796 unsigned long flags;
@@ -1812,7 +1813,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1812 clk_enable(udc->pclk); 1813 clk_enable(udc->pclk);
1813 clk_enable(udc->hclk); 1814 clk_enable(udc->hclk);
1814 1815
1815 ret = driver->bind(&udc->gadget); 1816 ret = bind(&udc->gadget);
1816 if (ret) { 1817 if (ret) {
1817 DBG(DBG_ERR, "Could not bind to driver %s: error %d\n", 1818 DBG(DBG_ERR, "Could not bind to driver %s: error %d\n",
1818 driver->driver.name, ret); 1819 driver->driver.name, ret);
@@ -1841,7 +1842,7 @@ err_driver_bind:
1841 udc->gadget.dev.driver = NULL; 1842 udc->gadget.dev.driver = NULL;
1842 return ret; 1843 return ret;
1843} 1844}
1844EXPORT_SYMBOL(usb_gadget_register_driver); 1845EXPORT_SYMBOL(usb_gadget_probe_driver);
1845 1846
1846int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1847int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1847{ 1848{
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 699695128e33..98b36fc88c77 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -2340,12 +2340,15 @@ static const struct usb_ep_ops usb_ep_ops = {
2340static const struct usb_gadget_ops usb_gadget_ops; 2340static const struct usb_gadget_ops usb_gadget_ops;
2341 2341
2342/** 2342/**
2343 * usb_gadget_register_driver: register a gadget driver 2343 * usb_gadget_probe_driver: register a gadget driver
2344 * @driver: the driver being registered
2345 * @bind: the driver's bind callback
2344 * 2346 *
2345 * Check usb_gadget_register_driver() at "usb_gadget.h" for details 2347 * Check usb_gadget_probe_driver() at <linux/usb/gadget.h> for details.
2346 * Interrupts are enabled here 2348 * Interrupts are enabled here.
2347 */ 2349 */
2348int usb_gadget_register_driver(struct usb_gadget_driver *driver) 2350int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
2351 int (*bind)(struct usb_gadget *))
2349{ 2352{
2350 struct ci13xxx *udc = _udc; 2353 struct ci13xxx *udc = _udc;
2351 unsigned long i, k, flags; 2354 unsigned long i, k, flags;
@@ -2354,7 +2357,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2354 trace("%p", driver); 2357 trace("%p", driver);
2355 2358
2356 if (driver == NULL || 2359 if (driver == NULL ||
2357 driver->bind == NULL || 2360 bind == NULL ||
2358 driver->unbind == NULL || 2361 driver->unbind == NULL ||
2359 driver->setup == NULL || 2362 driver->setup == NULL ||
2360 driver->disconnect == NULL || 2363 driver->disconnect == NULL ||
@@ -2430,7 +2433,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2430 udc->gadget.dev.driver = &driver->driver; 2433 udc->gadget.dev.driver = &driver->driver;
2431 2434
2432 spin_unlock_irqrestore(udc->lock, flags); 2435 spin_unlock_irqrestore(udc->lock, flags);
2433 retval = driver->bind(&udc->gadget); /* MAY SLEEP */ 2436 retval = bind(&udc->gadget); /* MAY SLEEP */
2434 spin_lock_irqsave(udc->lock, flags); 2437 spin_lock_irqsave(udc->lock, flags);
2435 2438
2436 if (retval) { 2439 if (retval) {
@@ -2447,7 +2450,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2447 usb_gadget_unregister_driver(driver); 2450 usb_gadget_unregister_driver(driver);
2448 return retval; 2451 return retval;
2449} 2452}
2450EXPORT_SYMBOL(usb_gadget_register_driver); 2453EXPORT_SYMBOL(usb_gadget_probe_driver);
2451 2454
2452/** 2455/**
2453 * usb_gadget_unregister_driver: unregister a gadget driver 2456 * usb_gadget_unregister_driver: unregister a gadget driver
@@ -2462,7 +2465,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
2462 trace("%p", driver); 2465 trace("%p", driver);
2463 2466
2464 if (driver == NULL || 2467 if (driver == NULL ||
2465 driver->bind == NULL ||
2466 driver->unbind == NULL || 2468 driver->unbind == NULL ||
2467 driver->setup == NULL || 2469 driver->setup == NULL ||
2468 driver->disconnect == NULL || 2470 driver->disconnect == NULL ||
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 717de39627c7..a3009bf01229 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1213,7 +1213,6 @@ composite_resume(struct usb_gadget *gadget)
1213static struct usb_gadget_driver composite_driver = { 1213static struct usb_gadget_driver composite_driver = {
1214 .speed = USB_SPEED_HIGH, 1214 .speed = USB_SPEED_HIGH,
1215 1215
1216 .bind = composite_bind,
1217 .unbind = composite_unbind, 1216 .unbind = composite_unbind,
1218 1217
1219 .setup = composite_setup, 1218 .setup = composite_setup,
@@ -1255,7 +1254,7 @@ int usb_composite_register(struct usb_composite_driver *driver)
1255 composite_driver.driver.name = driver->name; 1254 composite_driver.driver.name = driver->name;
1256 composite = driver; 1255 composite = driver;
1257 1256
1258 return usb_gadget_register_driver(&composite_driver); 1257 return usb_gadget_probe_driver(&composite_driver, composite_bind);
1259} 1258}
1260 1259
1261/** 1260/**
diff --git a/drivers/usb/gadget/dbgp.c b/drivers/usb/gadget/dbgp.c
index abe4a2ec5625..e5ac8a316fec 100644
--- a/drivers/usb/gadget/dbgp.c
+++ b/drivers/usb/gadget/dbgp.c
@@ -403,7 +403,6 @@ fail:
403static struct usb_gadget_driver dbgp_driver = { 403static struct usb_gadget_driver dbgp_driver = {
404 .function = "dbgp", 404 .function = "dbgp",
405 .speed = USB_SPEED_HIGH, 405 .speed = USB_SPEED_HIGH,
406 .bind = dbgp_bind,
407 .unbind = dbgp_unbind, 406 .unbind = dbgp_unbind,
408 .setup = dbgp_setup, 407 .setup = dbgp_setup,
409 .disconnect = dbgp_disconnect, 408 .disconnect = dbgp_disconnect,
@@ -415,7 +414,7 @@ static struct usb_gadget_driver dbgp_driver = {
415 414
416static int __init dbgp_init(void) 415static int __init dbgp_init(void)
417{ 416{
418 return usb_gadget_register_driver(&dbgp_driver); 417 return usb_gadget_probe_driver(&dbgp_driver, dbgp_bind);
419} 418}
420 419
421static void __exit dbgp_exit(void) 420static void __exit dbgp_exit(void)
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index dc6546248ed9..7bb9d78aac27 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -748,7 +748,8 @@ static DEVICE_ATTR (function, S_IRUGO, show_function, NULL);
748 */ 748 */
749 749
750int 750int
751usb_gadget_register_driver (struct usb_gadget_driver *driver) 751usb_gadget_probe_driver(struct usb_gadget_driver *driver,
752 int (*bind)(struct usb_gadget *))
752{ 753{
753 struct dummy *dum = the_controller; 754 struct dummy *dum = the_controller;
754 int retval, i; 755 int retval, i;
@@ -757,8 +758,7 @@ usb_gadget_register_driver (struct usb_gadget_driver *driver)
757 return -EINVAL; 758 return -EINVAL;
758 if (dum->driver) 759 if (dum->driver)
759 return -EBUSY; 760 return -EBUSY;
760 if (!driver->bind || !driver->setup 761 if (!bind || !driver->setup || driver->speed == USB_SPEED_UNKNOWN)
761 || driver->speed == USB_SPEED_UNKNOWN)
762 return -EINVAL; 762 return -EINVAL;
763 763
764 /* 764 /*
@@ -796,7 +796,7 @@ usb_gadget_register_driver (struct usb_gadget_driver *driver)
796 dum->gadget.dev.driver = &driver->driver; 796 dum->gadget.dev.driver = &driver->driver;
797 dev_dbg (udc_dev(dum), "binding gadget driver '%s'\n", 797 dev_dbg (udc_dev(dum), "binding gadget driver '%s'\n",
798 driver->driver.name); 798 driver->driver.name);
799 retval = driver->bind(&dum->gadget); 799 retval = bind(&dum->gadget);
800 if (retval) { 800 if (retval) {
801 dum->driver = NULL; 801 dum->driver = NULL;
802 dum->gadget.dev.driver = NULL; 802 dum->gadget.dev.driver = NULL;
@@ -812,7 +812,7 @@ usb_gadget_register_driver (struct usb_gadget_driver *driver)
812 usb_hcd_poll_rh_status (dummy_to_hcd (dum)); 812 usb_hcd_poll_rh_status (dummy_to_hcd (dum));
813 return 0; 813 return 0;
814} 814}
815EXPORT_SYMBOL (usb_gadget_register_driver); 815EXPORT_SYMBOL(usb_gadget_probe_driver);
816 816
817int 817int
818usb_gadget_unregister_driver (struct usb_gadget_driver *driver) 818usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index aae04c20b0ea..132a1c0877bd 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -3608,7 +3608,6 @@ static struct usb_gadget_driver fsg_driver = {
3608 .speed = USB_SPEED_FULL, 3608 .speed = USB_SPEED_FULL,
3609#endif 3609#endif
3610 .function = (char *) fsg_string_product, 3610 .function = (char *) fsg_string_product,
3611 .bind = fsg_bind,
3612 .unbind = fsg_unbind, 3611 .unbind = fsg_unbind,
3613 .disconnect = fsg_disconnect, 3612 .disconnect = fsg_disconnect,
3614 .setup = fsg_setup, 3613 .setup = fsg_setup,
@@ -3650,7 +3649,7 @@ static int __init fsg_init(void)
3650 if ((rc = fsg_alloc()) != 0) 3649 if ((rc = fsg_alloc()) != 0)
3651 return rc; 3650 return rc;
3652 fsg = the_fsg; 3651 fsg = the_fsg;
3653 if ((rc = usb_gadget_register_driver(&fsg_driver)) != 0) 3652 if ((rc = usb_gadget_probe_driver(&fsg_driver, fsg_bind)) != 0)
3654 kref_put(&fsg->ref, fsg_release); 3653 kref_put(&fsg->ref, fsg_release);
3655 return rc; 3654 return rc;
3656} 3655}
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index a5ea2c1d8c93..792d5ef40137 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -2302,9 +2302,10 @@ static irqreturn_t qe_udc_irq(int irq, void *_udc)
2302} 2302}
2303 2303
2304/*------------------------------------------------------------------------- 2304/*-------------------------------------------------------------------------
2305 Gadget driver register and unregister. 2305 Gadget driver probe and unregister.
2306 --------------------------------------------------------------------------*/ 2306 --------------------------------------------------------------------------*/
2307int usb_gadget_register_driver(struct usb_gadget_driver *driver) 2307int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
2308 int (*bind)(struct usb_gadget *))
2308{ 2309{
2309 int retval; 2310 int retval;
2310 unsigned long flags = 0; 2311 unsigned long flags = 0;
@@ -2315,8 +2316,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2315 2316
2316 if (!driver || (driver->speed != USB_SPEED_FULL 2317 if (!driver || (driver->speed != USB_SPEED_FULL
2317 && driver->speed != USB_SPEED_HIGH) 2318 && driver->speed != USB_SPEED_HIGH)
2318 || !driver->bind || !driver->disconnect 2319 || !bind || !driver->disconnect || !driver->setup)
2319 || !driver->setup)
2320 return -EINVAL; 2320 return -EINVAL;
2321 2321
2322 if (udc_controller->driver) 2322 if (udc_controller->driver)
@@ -2332,7 +2332,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2332 udc_controller->gadget.speed = (enum usb_device_speed)(driver->speed); 2332 udc_controller->gadget.speed = (enum usb_device_speed)(driver->speed);
2333 spin_unlock_irqrestore(&udc_controller->lock, flags); 2333 spin_unlock_irqrestore(&udc_controller->lock, flags);
2334 2334
2335 retval = driver->bind(&udc_controller->gadget); 2335 retval = bind(&udc_controller->gadget);
2336 if (retval) { 2336 if (retval) {
2337 dev_err(udc_controller->dev, "bind to %s --> %d", 2337 dev_err(udc_controller->dev, "bind to %s --> %d",
2338 driver->driver.name, retval); 2338 driver->driver.name, retval);
@@ -2353,7 +2353,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2353 udc_controller->gadget.name, driver->driver.name); 2353 udc_controller->gadget.name, driver->driver.name);
2354 return 0; 2354 return 0;
2355} 2355}
2356EXPORT_SYMBOL(usb_gadget_register_driver); 2356EXPORT_SYMBOL(usb_gadget_probe_driver);
2357 2357
2358int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 2358int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
2359{ 2359{
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 08a9a62a39e3..c16b402a876b 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -1765,7 +1765,8 @@ static irqreturn_t fsl_udc_irq(int irq, void *_udc)
1765 * Hook to gadget drivers 1765 * Hook to gadget drivers
1766 * Called by initialization code of gadget drivers 1766 * Called by initialization code of gadget drivers
1767*----------------------------------------------------------------*/ 1767*----------------------------------------------------------------*/
1768int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1768int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1769 int (*bind)(struct usb_gadget *))
1769{ 1770{
1770 int retval = -ENODEV; 1771 int retval = -ENODEV;
1771 unsigned long flags = 0; 1772 unsigned long flags = 0;
@@ -1775,8 +1776,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1775 1776
1776 if (!driver || (driver->speed != USB_SPEED_FULL 1777 if (!driver || (driver->speed != USB_SPEED_FULL
1777 && driver->speed != USB_SPEED_HIGH) 1778 && driver->speed != USB_SPEED_HIGH)
1778 || !driver->bind || !driver->disconnect 1779 || !bind || !driver->disconnect || !driver->setup)
1779 || !driver->setup)
1780 return -EINVAL; 1780 return -EINVAL;
1781 1781
1782 if (udc_controller->driver) 1782 if (udc_controller->driver)
@@ -1792,7 +1792,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1792 spin_unlock_irqrestore(&udc_controller->lock, flags); 1792 spin_unlock_irqrestore(&udc_controller->lock, flags);
1793 1793
1794 /* bind udc driver to gadget driver */ 1794 /* bind udc driver to gadget driver */
1795 retval = driver->bind(&udc_controller->gadget); 1795 retval = bind(&udc_controller->gadget);
1796 if (retval) { 1796 if (retval) {
1797 VDBG("bind to %s --> %d", driver->driver.name, retval); 1797 VDBG("bind to %s --> %d", driver->driver.name, retval);
1798 udc_controller->gadget.dev.driver = NULL; 1798 udc_controller->gadget.dev.driver = NULL;
@@ -1814,7 +1814,7 @@ out:
1814 retval); 1814 retval);
1815 return retval; 1815 return retval;
1816} 1816}
1817EXPORT_SYMBOL(usb_gadget_register_driver); 1817EXPORT_SYMBOL(usb_gadget_probe_driver);
1818 1818
1819/* Disconnect from gadget driver */ 1819/* Disconnect from gadget driver */
1820int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1820int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index b7bf88019b06..0ab7e141d494 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -1292,7 +1292,6 @@ static void gmidi_resume(struct usb_gadget *gadget)
1292static struct usb_gadget_driver gmidi_driver = { 1292static struct usb_gadget_driver gmidi_driver = {
1293 .speed = USB_SPEED_FULL, 1293 .speed = USB_SPEED_FULL,
1294 .function = (char *)longname, 1294 .function = (char *)longname,
1295 .bind = gmidi_bind,
1296 .unbind = gmidi_unbind, 1295 .unbind = gmidi_unbind,
1297 1296
1298 .setup = gmidi_setup, 1297 .setup = gmidi_setup,
@@ -1309,7 +1308,7 @@ static struct usb_gadget_driver gmidi_driver = {
1309 1308
1310static int __init gmidi_init(void) 1309static int __init gmidi_init(void)
1311{ 1310{
1312 return usb_gadget_register_driver(&gmidi_driver); 1311 return usb_gadget_probe_driver(&gmidi_driver, gmidi_bind);
1313} 1312}
1314module_init(gmidi_init); 1313module_init(gmidi_init);
1315 1314
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index 1088d08c7ed8..49fbd4dbeb94 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -1343,14 +1343,15 @@ static struct goku_udc *the_controller;
1343 * disconnect is reported. then a host may connect again, or 1343 * disconnect is reported. then a host may connect again, or
1344 * the driver might get unbound. 1344 * the driver might get unbound.
1345 */ 1345 */
1346int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1346int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1347 int (*bind)(struct usb_gadget *))
1347{ 1348{
1348 struct goku_udc *dev = the_controller; 1349 struct goku_udc *dev = the_controller;
1349 int retval; 1350 int retval;
1350 1351
1351 if (!driver 1352 if (!driver
1352 || driver->speed < USB_SPEED_FULL 1353 || driver->speed < USB_SPEED_FULL
1353 || !driver->bind 1354 || !bind
1354 || !driver->disconnect 1355 || !driver->disconnect
1355 || !driver->setup) 1356 || !driver->setup)
1356 return -EINVAL; 1357 return -EINVAL;
@@ -1363,7 +1364,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1363 driver->driver.bus = NULL; 1364 driver->driver.bus = NULL;
1364 dev->driver = driver; 1365 dev->driver = driver;
1365 dev->gadget.dev.driver = &driver->driver; 1366 dev->gadget.dev.driver = &driver->driver;
1366 retval = driver->bind(&dev->gadget); 1367 retval = bind(&dev->gadget);
1367 if (retval) { 1368 if (retval) {
1368 DBG(dev, "bind to driver %s --> error %d\n", 1369 DBG(dev, "bind to driver %s --> error %d\n",
1369 driver->driver.name, retval); 1370 driver->driver.name, retval);
@@ -1380,7 +1381,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1380 DBG(dev, "registered gadget driver '%s'\n", driver->driver.name); 1381 DBG(dev, "registered gadget driver '%s'\n", driver->driver.name);
1381 return 0; 1382 return 0;
1382} 1383}
1383EXPORT_SYMBOL(usb_gadget_register_driver); 1384EXPORT_SYMBOL(usb_gadget_probe_driver);
1384 1385
1385static void 1386static void
1386stop_activity(struct goku_udc *dev, struct usb_gadget_driver *driver) 1387stop_activity(struct goku_udc *dev, struct usb_gadget_driver *driver)
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c
index e743122fcd93..ed0266462c57 100644
--- a/drivers/usb/gadget/imx_udc.c
+++ b/drivers/usb/gadget/imx_udc.c
@@ -1319,14 +1319,15 @@ static struct imx_udc_struct controller = {
1319 * USB gadged driver functions 1319 * USB gadged driver functions
1320 ******************************************************************************* 1320 *******************************************************************************
1321 */ 1321 */
1322int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1322int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1323 int (*bind)(struct usb_gadget *))
1323{ 1324{
1324 struct imx_udc_struct *imx_usb = &controller; 1325 struct imx_udc_struct *imx_usb = &controller;
1325 int retval; 1326 int retval;
1326 1327
1327 if (!driver 1328 if (!driver
1328 || driver->speed < USB_SPEED_FULL 1329 || driver->speed < USB_SPEED_FULL
1329 || !driver->bind 1330 || !bind
1330 || !driver->disconnect 1331 || !driver->disconnect
1331 || !driver->setup) 1332 || !driver->setup)
1332 return -EINVAL; 1333 return -EINVAL;
@@ -1342,7 +1343,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1342 retval = device_add(&imx_usb->gadget.dev); 1343 retval = device_add(&imx_usb->gadget.dev);
1343 if (retval) 1344 if (retval)
1344 goto fail; 1345 goto fail;
1345 retval = driver->bind(&imx_usb->gadget); 1346 retval = bind(&imx_usb->gadget);
1346 if (retval) { 1347 if (retval) {
1347 D_ERR(imx_usb->dev, "<%s> bind to driver %s --> error %d\n", 1348 D_ERR(imx_usb->dev, "<%s> bind to driver %s --> error %d\n",
1348 __func__, driver->driver.name, retval); 1349 __func__, driver->driver.name, retval);
@@ -1362,7 +1363,7 @@ fail:
1362 imx_usb->gadget.dev.driver = NULL; 1363 imx_usb->gadget.dev.driver = NULL;
1363 return retval; 1364 return retval;
1364} 1365}
1365EXPORT_SYMBOL(usb_gadget_register_driver); 1366EXPORT_SYMBOL(usb_gadget_probe_driver);
1366 1367
1367int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1368int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1368{ 1369{
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index fc35406fc80c..e2e8eda83f0d 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1775,7 +1775,6 @@ static struct usb_gadget_driver gadgetfs_driver = {
1775 .speed = USB_SPEED_FULL, 1775 .speed = USB_SPEED_FULL,
1776#endif 1776#endif
1777 .function = (char *) driver_desc, 1777 .function = (char *) driver_desc,
1778 .bind = gadgetfs_bind,
1779 .unbind = gadgetfs_unbind, 1778 .unbind = gadgetfs_unbind,
1780 .setup = gadgetfs_setup, 1779 .setup = gadgetfs_setup,
1781 .disconnect = gadgetfs_disconnect, 1780 .disconnect = gadgetfs_disconnect,
@@ -1798,7 +1797,6 @@ static int gadgetfs_probe (struct usb_gadget *gadget)
1798 1797
1799static struct usb_gadget_driver probe_driver = { 1798static struct usb_gadget_driver probe_driver = {
1800 .speed = USB_SPEED_HIGH, 1799 .speed = USB_SPEED_HIGH,
1801 .bind = gadgetfs_probe,
1802 .unbind = gadgetfs_nop, 1800 .unbind = gadgetfs_nop,
1803 .setup = (void *)gadgetfs_nop, 1801 .setup = (void *)gadgetfs_nop,
1804 .disconnect = gadgetfs_nop, 1802 .disconnect = gadgetfs_nop,
@@ -1908,7 +1906,7 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
1908 1906
1909 /* triggers gadgetfs_bind(); then we can enumerate. */ 1907 /* triggers gadgetfs_bind(); then we can enumerate. */
1910 spin_unlock_irq (&dev->lock); 1908 spin_unlock_irq (&dev->lock);
1911 value = usb_gadget_register_driver (&gadgetfs_driver); 1909 value = usb_gadget_probe_driver(&gadgetfs_driver, gadgetfs_bind);
1912 if (value != 0) { 1910 if (value != 0) {
1913 kfree (dev->buf); 1911 kfree (dev->buf);
1914 dev->buf = NULL; 1912 dev->buf = NULL;
@@ -2047,7 +2045,7 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
2047 return -ESRCH; 2045 return -ESRCH;
2048 2046
2049 /* fake probe to determine $CHIP */ 2047 /* fake probe to determine $CHIP */
2050 (void) usb_gadget_register_driver (&probe_driver); 2048 (void) usb_gadget_probe_driver(&probe_driver, gadgetfs_probe);
2051 if (!CHIP) 2049 if (!CHIP)
2052 return -ENODEV; 2050 return -ENODEV;
2053 2051
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index ccc9c070a30d..1ef17a6dcb51 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -1855,7 +1855,8 @@ static DEVICE_ATTR(remote_wakeup, S_IWUSR, NULL, store_remote_wakeup);
1855 * the driver might get unbound. 1855 * the driver might get unbound.
1856 */ 1856 */
1857 1857
1858int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1858int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1859 int (*bind)(struct usb_gadget *))
1859{ 1860{
1860 struct langwell_udc *dev = the_controller; 1861 struct langwell_udc *dev = the_controller;
1861 unsigned long flags; 1862 unsigned long flags;
@@ -1878,7 +1879,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1878 1879
1879 spin_unlock_irqrestore(&dev->lock, flags); 1880 spin_unlock_irqrestore(&dev->lock, flags);
1880 1881
1881 retval = driver->bind(&dev->gadget); 1882 retval = bind(&dev->gadget);
1882 if (retval) { 1883 if (retval) {
1883 dev_dbg(&dev->pdev->dev, "bind to driver %s --> %d\n", 1884 dev_dbg(&dev->pdev->dev, "bind to driver %s --> %d\n",
1884 driver->driver.name, retval); 1885 driver->driver.name, retval);
@@ -1916,7 +1917,7 @@ err_unbind:
1916 dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__); 1917 dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
1917 return retval; 1918 return retval;
1918} 1919}
1919EXPORT_SYMBOL(usb_gadget_register_driver); 1920EXPORT_SYMBOL(usb_gadget_probe_driver);
1920 1921
1921 1922
1922/* unregister gadget driver */ 1923/* unregister gadget driver */
@@ -1930,7 +1931,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1930 1931
1931 dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__); 1932 dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
1932 1933
1933 if (unlikely(!driver || !driver->bind || !driver->unbind)) 1934 if (unlikely(!driver || !driver->unbind))
1934 return -EINVAL; 1935 return -EINVAL;
1935 1936
1936 /* exit PHY low power suspend */ 1937 /* exit PHY low power suspend */
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index fded3fca793b..6b58bd8ce623 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -408,7 +408,8 @@ static void udc_enable(struct lh7a40x_udc *dev)
408/* 408/*
409 Register entry point for the peripheral controller driver. 409 Register entry point for the peripheral controller driver.
410*/ 410*/
411int usb_gadget_register_driver(struct usb_gadget_driver *driver) 411int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
412 int (*bind)(struct usb_gadget *))
412{ 413{
413 struct lh7a40x_udc *dev = the_controller; 414 struct lh7a40x_udc *dev = the_controller;
414 int retval; 415 int retval;
@@ -417,7 +418,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
417 418
418 if (!driver 419 if (!driver
419 || driver->speed != USB_SPEED_FULL 420 || driver->speed != USB_SPEED_FULL
420 || !driver->bind 421 || !bind
421 || !driver->disconnect 422 || !driver->disconnect
422 || !driver->setup) 423 || !driver->setup)
423 return -EINVAL; 424 return -EINVAL;
@@ -431,7 +432,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
431 dev->gadget.dev.driver = &driver->driver; 432 dev->gadget.dev.driver = &driver->driver;
432 433
433 device_add(&dev->gadget.dev); 434 device_add(&dev->gadget.dev);
434 retval = driver->bind(&dev->gadget); 435 retval = bind(&dev->gadget);
435 if (retval) { 436 if (retval) {
436 printk(KERN_WARNING "%s: bind to driver %s --> error %d\n", 437 printk(KERN_WARNING "%s: bind to driver %s --> error %d\n",
437 dev->gadget.name, driver->driver.name, retval); 438 dev->gadget.name, driver->driver.name, retval);
@@ -453,8 +454,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
453 454
454 return 0; 455 return 0;
455} 456}
456 457EXPORT_SYMBOL(usb_gadget_probe_driver);
457EXPORT_SYMBOL(usb_gadget_register_driver);
458 458
459/* 459/*
460 Unregister entry point for the peripheral controller driver. 460 Unregister entry point for the peripheral controller driver.
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index e03058fe23cb..51b19f3027e7 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1454,14 +1454,15 @@ static struct usb_ep_ops m66592_ep_ops = {
1454/*-------------------------------------------------------------------------*/ 1454/*-------------------------------------------------------------------------*/
1455static struct m66592 *the_controller; 1455static struct m66592 *the_controller;
1456 1456
1457int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1457int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1458 int (*bind)(struct usb_gadget *))
1458{ 1459{
1459 struct m66592 *m66592 = the_controller; 1460 struct m66592 *m66592 = the_controller;
1460 int retval; 1461 int retval;
1461 1462
1462 if (!driver 1463 if (!driver
1463 || driver->speed != USB_SPEED_HIGH 1464 || driver->speed != USB_SPEED_HIGH
1464 || !driver->bind 1465 || !bind
1465 || !driver->setup) 1466 || !driver->setup)
1466 return -EINVAL; 1467 return -EINVAL;
1467 if (!m66592) 1468 if (!m66592)
@@ -1480,7 +1481,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1480 goto error; 1481 goto error;
1481 } 1482 }
1482 1483
1483 retval = driver->bind (&m66592->gadget); 1484 retval = bind(&m66592->gadget);
1484 if (retval) { 1485 if (retval) {
1485 pr_err("bind to driver error (%d)\n", retval); 1486 pr_err("bind to driver error (%d)\n", retval);
1486 device_del(&m66592->gadget.dev); 1487 device_del(&m66592->gadget.dev);
@@ -1505,7 +1506,7 @@ error:
1505 1506
1506 return retval; 1507 return retval;
1507} 1508}
1508EXPORT_SYMBOL(usb_gadget_register_driver); 1509EXPORT_SYMBOL(usb_gadget_probe_driver);
1509 1510
1510int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1511int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1511{ 1512{
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 9498be87a724..d09155b25d73 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -1929,7 +1929,8 @@ static void ep0_start (struct net2280 *dev)
1929 * disconnect is reported. then a host may connect again, or 1929 * disconnect is reported. then a host may connect again, or
1930 * the driver might get unbound. 1930 * the driver might get unbound.
1931 */ 1931 */
1932int usb_gadget_register_driver (struct usb_gadget_driver *driver) 1932int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1933 int (*bind)(struct usb_gadget *))
1933{ 1934{
1934 struct net2280 *dev = the_controller; 1935 struct net2280 *dev = the_controller;
1935 int retval; 1936 int retval;
@@ -1941,8 +1942,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
1941 */ 1942 */
1942 if (!driver 1943 if (!driver
1943 || driver->speed != USB_SPEED_HIGH 1944 || driver->speed != USB_SPEED_HIGH
1944 || !driver->bind 1945 || !bind || !driver->setup)
1945 || !driver->setup)
1946 return -EINVAL; 1946 return -EINVAL;
1947 if (!dev) 1947 if (!dev)
1948 return -ENODEV; 1948 return -ENODEV;
@@ -1957,7 +1957,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
1957 driver->driver.bus = NULL; 1957 driver->driver.bus = NULL;
1958 dev->driver = driver; 1958 dev->driver = driver;
1959 dev->gadget.dev.driver = &driver->driver; 1959 dev->gadget.dev.driver = &driver->driver;
1960 retval = driver->bind (&dev->gadget); 1960 retval = bind(&dev->gadget);
1961 if (retval) { 1961 if (retval) {
1962 DEBUG (dev, "bind to driver %s --> %d\n", 1962 DEBUG (dev, "bind to driver %s --> %d\n",
1963 driver->driver.name, retval); 1963 driver->driver.name, retval);
@@ -1993,7 +1993,7 @@ err_unbind:
1993 dev->driver = NULL; 1993 dev->driver = NULL;
1994 return retval; 1994 return retval;
1995} 1995}
1996EXPORT_SYMBOL (usb_gadget_register_driver); 1996EXPORT_SYMBOL(usb_gadget_probe_driver);
1997 1997
1998static void 1998static void
1999stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver) 1999stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver)
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index f81e4f025f23..61d3ca6619bb 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2102,7 +2102,8 @@ static inline int machine_without_vbus_sense(void)
2102 ); 2102 );
2103} 2103}
2104 2104
2105int usb_gadget_register_driver (struct usb_gadget_driver *driver) 2105int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
2106 int (*bind)(struct usb_gadget *))
2106{ 2107{
2107 int status = -ENODEV; 2108 int status = -ENODEV;
2108 struct omap_ep *ep; 2109 struct omap_ep *ep;
@@ -2114,8 +2115,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2114 if (!driver 2115 if (!driver
2115 // FIXME if otg, check: driver->is_otg 2116 // FIXME if otg, check: driver->is_otg
2116 || driver->speed < USB_SPEED_FULL 2117 || driver->speed < USB_SPEED_FULL
2117 || !driver->bind 2118 || !bind || !driver->setup)
2118 || !driver->setup)
2119 return -EINVAL; 2119 return -EINVAL;
2120 2120
2121 spin_lock_irqsave(&udc->lock, flags); 2121 spin_lock_irqsave(&udc->lock, flags);
@@ -2145,7 +2145,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2145 if (udc->dc_clk != NULL) 2145 if (udc->dc_clk != NULL)
2146 omap_udc_enable_clock(1); 2146 omap_udc_enable_clock(1);
2147 2147
2148 status = driver->bind (&udc->gadget); 2148 status = bind(&udc->gadget);
2149 if (status) { 2149 if (status) {
2150 DBG("bind to %s --> %d\n", driver->driver.name, status); 2150 DBG("bind to %s --> %d\n", driver->driver.name, status);
2151 udc->gadget.dev.driver = NULL; 2151 udc->gadget.dev.driver = NULL;
@@ -2186,7 +2186,7 @@ done:
2186 omap_udc_enable_clock(0); 2186 omap_udc_enable_clock(0);
2187 return status; 2187 return status;
2188} 2188}
2189EXPORT_SYMBOL(usb_gadget_register_driver); 2189EXPORT_SYMBOL(usb_gadget_probe_driver);
2190 2190
2191int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) 2191int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
2192{ 2192{
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 04c7bbf121af..ded080a1c8ce 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -1543,7 +1543,6 @@ static struct usb_gadget_driver printer_driver = {
1543 .speed = DEVSPEED, 1543 .speed = DEVSPEED,
1544 1544
1545 .function = (char *) driver_desc, 1545 .function = (char *) driver_desc,
1546 .bind = printer_bind,
1547 .unbind = printer_unbind, 1546 .unbind = printer_unbind,
1548 1547
1549 .setup = printer_setup, 1548 .setup = printer_setup,
@@ -1579,11 +1578,11 @@ init(void)
1579 return status; 1578 return status;
1580 } 1579 }
1581 1580
1582 status = usb_gadget_register_driver(&printer_driver); 1581 status = usb_gadget_probe_driver(&printer_driver, printer_bind);
1583 if (status) { 1582 if (status) {
1584 class_destroy(usb_gadget_class); 1583 class_destroy(usb_gadget_class);
1585 unregister_chrdev_region(g_printer_devno, 1); 1584 unregister_chrdev_region(g_printer_devno, 1);
1586 DBG(dev, "usb_gadget_register_driver %x\n", status); 1585 DBG(dev, "usb_gadget_probe_driver %x\n", status);
1587 } 1586 }
1588 1587
1589 return status; 1588 return status;
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index be5fb34d9602..b37f92cb71bc 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -1280,14 +1280,15 @@ static void udc_enable (struct pxa25x_udc *dev)
1280 * disconnect is reported. then a host may connect again, or 1280 * disconnect is reported. then a host may connect again, or
1281 * the driver might get unbound. 1281 * the driver might get unbound.
1282 */ 1282 */
1283int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1283int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1284 int (*bind)(struct usb_gadget *))
1284{ 1285{
1285 struct pxa25x_udc *dev = the_controller; 1286 struct pxa25x_udc *dev = the_controller;
1286 int retval; 1287 int retval;
1287 1288
1288 if (!driver 1289 if (!driver
1289 || driver->speed < USB_SPEED_FULL 1290 || driver->speed < USB_SPEED_FULL
1290 || !driver->bind 1291 || !bind
1291 || !driver->disconnect 1292 || !driver->disconnect
1292 || !driver->setup) 1293 || !driver->setup)
1293 return -EINVAL; 1294 return -EINVAL;
@@ -1308,7 +1309,7 @@ fail:
1308 dev->gadget.dev.driver = NULL; 1309 dev->gadget.dev.driver = NULL;
1309 return retval; 1310 return retval;
1310 } 1311 }
1311 retval = driver->bind(&dev->gadget); 1312 retval = bind(&dev->gadget);
1312 if (retval) { 1313 if (retval) {
1313 DMSG("bind to driver %s --> error %d\n", 1314 DMSG("bind to driver %s --> error %d\n",
1314 driver->driver.name, retval); 1315 driver->driver.name, retval);
@@ -1338,7 +1339,7 @@ fail:
1338bind_fail: 1339bind_fail:
1339 return retval; 1340 return retval;
1340} 1341}
1341EXPORT_SYMBOL(usb_gadget_register_driver); 1342EXPORT_SYMBOL(usb_gadget_probe_driver);
1342 1343
1343static void 1344static void
1344stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver) 1345stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver)
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 980762453a9c..027d66f81620 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1792,8 +1792,9 @@ static void udc_enable(struct pxa_udc *udc)
1792} 1792}
1793 1793
1794/** 1794/**
1795 * usb_gadget_register_driver - Register gadget driver 1795 * usb_gadget_probe_driver - Register gadget driver
1796 * @driver: gadget driver 1796 * @driver: gadget driver
1797 * @bind: bind function
1797 * 1798 *
1798 * When a driver is successfully registered, it will receive control requests 1799 * When a driver is successfully registered, it will receive control requests
1799 * including set_configuration(), which enables non-control requests. Then 1800 * including set_configuration(), which enables non-control requests. Then
@@ -1805,12 +1806,13 @@ static void udc_enable(struct pxa_udc *udc)
1805 * 1806 *
1806 * Returns 0 if no error, -EINVAL, -ENODEV, -EBUSY otherwise 1807 * Returns 0 if no error, -EINVAL, -ENODEV, -EBUSY otherwise
1807 */ 1808 */
1808int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1809int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1810 int (*bind)(struct usb_gadget *))
1809{ 1811{
1810 struct pxa_udc *udc = the_controller; 1812 struct pxa_udc *udc = the_controller;
1811 int retval; 1813 int retval;
1812 1814
1813 if (!driver || driver->speed < USB_SPEED_FULL || !driver->bind 1815 if (!driver || driver->speed < USB_SPEED_FULL || !bind
1814 || !driver->disconnect || !driver->setup) 1816 || !driver->disconnect || !driver->setup)
1815 return -EINVAL; 1817 return -EINVAL;
1816 if (!udc) 1818 if (!udc)
@@ -1828,7 +1830,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1828 dev_err(udc->dev, "device_add error %d\n", retval); 1830 dev_err(udc->dev, "device_add error %d\n", retval);
1829 goto add_fail; 1831 goto add_fail;
1830 } 1832 }
1831 retval = driver->bind(&udc->gadget); 1833 retval = bind(&udc->gadget);
1832 if (retval) { 1834 if (retval) {
1833 dev_err(udc->dev, "bind to driver %s --> error %d\n", 1835 dev_err(udc->dev, "bind to driver %s --> error %d\n",
1834 driver->driver.name, retval); 1836 driver->driver.name, retval);
@@ -1859,7 +1861,7 @@ add_fail:
1859 udc->gadget.dev.driver = NULL; 1861 udc->gadget.dev.driver = NULL;
1860 return retval; 1862 return retval;
1861} 1863}
1862EXPORT_SYMBOL(usb_gadget_register_driver); 1864EXPORT_SYMBOL(usb_gadget_probe_driver);
1863 1865
1864 1866
1865/** 1867/**
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 2456ccd9965e..95092151f901 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1405,14 +1405,15 @@ static struct usb_ep_ops r8a66597_ep_ops = {
1405/*-------------------------------------------------------------------------*/ 1405/*-------------------------------------------------------------------------*/
1406static struct r8a66597 *the_controller; 1406static struct r8a66597 *the_controller;
1407 1407
1408int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1408int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1409 int (*bind)(struct usb_gadget *))
1409{ 1410{
1410 struct r8a66597 *r8a66597 = the_controller; 1411 struct r8a66597 *r8a66597 = the_controller;
1411 int retval; 1412 int retval;
1412 1413
1413 if (!driver 1414 if (!driver
1414 || driver->speed != USB_SPEED_HIGH 1415 || driver->speed != USB_SPEED_HIGH
1415 || !driver->bind 1416 || !bind
1416 || !driver->setup) 1417 || !driver->setup)
1417 return -EINVAL; 1418 return -EINVAL;
1418 if (!r8a66597) 1419 if (!r8a66597)
@@ -1431,7 +1432,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1431 goto error; 1432 goto error;
1432 } 1433 }
1433 1434
1434 retval = driver->bind(&r8a66597->gadget); 1435 retval = bind(&r8a66597->gadget);
1435 if (retval) { 1436 if (retval) {
1436 printk(KERN_ERR "bind to driver error (%d)\n", retval); 1437 printk(KERN_ERR "bind to driver error (%d)\n", retval);
1437 device_del(&r8a66597->gadget.dev); 1438 device_del(&r8a66597->gadget.dev);
@@ -1456,7 +1457,7 @@ error:
1456 1457
1457 return retval; 1458 return retval;
1458} 1459}
1459EXPORT_SYMBOL(usb_gadget_register_driver); 1460EXPORT_SYMBOL(usb_gadget_probe_driver);
1460 1461
1461int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1462int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1462{ 1463{
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index a229744a8c7d..ef825c3baed9 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -2523,7 +2523,8 @@ static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg)
2523 return 0; 2523 return 0;
2524} 2524}
2525 2525
2526int usb_gadget_register_driver(struct usb_gadget_driver *driver) 2526int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
2527 int (*bind)(struct usb_gadget *))
2527{ 2528{
2528 struct s3c_hsotg *hsotg = our_hsotg; 2529 struct s3c_hsotg *hsotg = our_hsotg;
2529 int ret; 2530 int ret;
@@ -2543,7 +2544,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2543 dev_err(hsotg->dev, "%s: bad speed\n", __func__); 2544 dev_err(hsotg->dev, "%s: bad speed\n", __func__);
2544 } 2545 }
2545 2546
2546 if (!driver->bind || !driver->setup) { 2547 if (!bind || !driver->setup) {
2547 dev_err(hsotg->dev, "%s: missing entry points\n", __func__); 2548 dev_err(hsotg->dev, "%s: missing entry points\n", __func__);
2548 return -EINVAL; 2549 return -EINVAL;
2549 } 2550 }
@@ -2562,7 +2563,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2562 goto err; 2563 goto err;
2563 } 2564 }
2564 2565
2565 ret = driver->bind(&hsotg->gadget); 2566 ret = bind(&hsotg->gadget);
2566 if (ret) { 2567 if (ret) {
2567 dev_err(hsotg->dev, "failed bind %s\n", driver->driver.name); 2568 dev_err(hsotg->dev, "failed bind %s\n", driver->driver.name);
2568 2569
@@ -2687,7 +2688,7 @@ err:
2687 hsotg->gadget.dev.driver = NULL; 2688 hsotg->gadget.dev.driver = NULL;
2688 return ret; 2689 return ret;
2689} 2690}
2690EXPORT_SYMBOL(usb_gadget_register_driver); 2691EXPORT_SYMBOL(usb_gadget_probe_driver);
2691 2692
2692int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 2693int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
2693{ 2694{
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index ea2b3c7ebee5..c2448950a8d8 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -1632,15 +1632,15 @@ static void s3c2410_udc_enable(struct s3c2410_udc *dev)
1632} 1632}
1633 1633
1634/* 1634/*
1635 * usb_gadget_register_driver 1635 * usb_gadget_probe_driver
1636 */ 1636 */
1637int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1637int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1638 int (*bind)(struct usb_gadget *))
1638{ 1639{
1639 struct s3c2410_udc *udc = the_controller; 1640 struct s3c2410_udc *udc = the_controller;
1640 int retval; 1641 int retval;
1641 1642
1642 dprintk(DEBUG_NORMAL, "usb_gadget_register_driver() '%s'\n", 1643 dprintk(DEBUG_NORMAL, "%s() '%s'\n", __func__, driver->driver.name);
1643 driver->driver.name);
1644 1644
1645 /* Sanity checks */ 1645 /* Sanity checks */
1646 if (!udc) 1646 if (!udc)
@@ -1649,10 +1649,9 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1649 if (udc->driver) 1649 if (udc->driver)
1650 return -EBUSY; 1650 return -EBUSY;
1651 1651
1652 if (!driver->bind || !driver->setup 1652 if (!bind || !driver->setup || driver->speed < USB_SPEED_FULL) {
1653 || driver->speed < USB_SPEED_FULL) {
1654 printk(KERN_ERR "Invalid driver: bind %p setup %p speed %d\n", 1653 printk(KERN_ERR "Invalid driver: bind %p setup %p speed %d\n",
1655 driver->bind, driver->setup, driver->speed); 1654 bind, driver->setup, driver->speed);
1656 return -EINVAL; 1655 return -EINVAL;
1657 } 1656 }
1658#if defined(MODULE) 1657#if defined(MODULE)
@@ -1675,7 +1674,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1675 dprintk(DEBUG_NORMAL, "binding gadget driver '%s'\n", 1674 dprintk(DEBUG_NORMAL, "binding gadget driver '%s'\n",
1676 driver->driver.name); 1675 driver->driver.name);
1677 1676
1678 if ((retval = driver->bind (&udc->gadget)) != 0) { 1677 if ((retval = bind(&udc->gadget)) != 0) {
1679 device_del(&udc->gadget.dev); 1678 device_del(&udc->gadget.dev);
1680 goto register_error; 1679 goto register_error;
1681 } 1680 }
@@ -1690,6 +1689,7 @@ register_error:
1690 udc->gadget.dev.driver = NULL; 1689 udc->gadget.dev.driver = NULL;
1691 return retval; 1690 return retval;
1692} 1691}
1692EXPORT_SYMBOL(usb_gadget_probe_driver);
1693 1693
1694/* 1694/*
1695 * usb_gadget_unregister_driver 1695 * usb_gadget_unregister_driver
@@ -2049,7 +2049,6 @@ static void __exit udc_exit(void)
2049} 2049}
2050 2050
2051EXPORT_SYMBOL(usb_gadget_unregister_driver); 2051EXPORT_SYMBOL(usb_gadget_unregister_driver);
2052EXPORT_SYMBOL(usb_gadget_register_driver);
2053 2052
2054module_init(udc_init); 2053module_init(udc_init);
2055module_exit(udc_exit); 2054module_exit(udc_exit);
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d065e23f123e..ecd5f8cffcbf 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1699,9 +1699,11 @@ void musb_gadget_cleanup(struct musb *musb)
1699 * -ENOMEM no memeory to perform the operation 1699 * -ENOMEM no memeory to perform the operation
1700 * 1700 *
1701 * @param driver the gadget driver 1701 * @param driver the gadget driver
1702 * @param bind the driver's bind function
1702 * @return <0 if error, 0 if everything is fine 1703 * @return <0 if error, 0 if everything is fine
1703 */ 1704 */
1704int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1705int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1706 int (*bind)(struct usb_gadget *))
1705{ 1707{
1706 int retval; 1708 int retval;
1707 unsigned long flags; 1709 unsigned long flags;
@@ -1709,8 +1711,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1709 1711
1710 if (!driver 1712 if (!driver
1711 || driver->speed != USB_SPEED_HIGH 1713 || driver->speed != USB_SPEED_HIGH
1712 || !driver->bind 1714 || !bind || !driver->setup)
1713 || !driver->setup)
1714 return -EINVAL; 1715 return -EINVAL;
1715 1716
1716 /* driver must be initialized to support peripheral mode */ 1717 /* driver must be initialized to support peripheral mode */
@@ -1738,7 +1739,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1738 spin_unlock_irqrestore(&musb->lock, flags); 1739 spin_unlock_irqrestore(&musb->lock, flags);
1739 1740
1740 if (retval == 0) { 1741 if (retval == 0) {
1741 retval = driver->bind(&musb->g); 1742 retval = bind(&musb->g);
1742 if (retval != 0) { 1743 if (retval != 0) {
1743 DBG(3, "bind to driver %s failed --> %d\n", 1744 DBG(3, "bind to driver %s failed --> %d\n",
1744 driver->driver.name, retval); 1745 driver->driver.name, retval);
@@ -1786,7 +1787,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1786 1787
1787 return retval; 1788 return retval;
1788} 1789}
1789EXPORT_SYMBOL(usb_gadget_register_driver); 1790EXPORT_SYMBOL(usb_gadget_probe_driver);
1790 1791
1791static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver) 1792static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver)
1792{ 1793{