From b0fca50f5a94a268ed02cfddf44448051ed9343f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Thu, 12 Aug 2010 17:43:53 +0200 Subject: usb gadget: don't save bind callback in struct usb_gadget_driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 [m.nazarewicz@samsung.com: added dbgp] Signed-off-by: Michał Nazarewicz Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/s3c2410_udc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'drivers/usb/gadget/s3c2410_udc.c') 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) } /* - * usb_gadget_register_driver + * usb_gadget_probe_driver */ -int usb_gadget_register_driver(struct usb_gadget_driver *driver) +int usb_gadget_probe_driver(struct usb_gadget_driver *driver, + int (*bind)(struct usb_gadget *)) { struct s3c2410_udc *udc = the_controller; int retval; - dprintk(DEBUG_NORMAL, "usb_gadget_register_driver() '%s'\n", - driver->driver.name); + dprintk(DEBUG_NORMAL, "%s() '%s'\n", __func__, driver->driver.name); /* Sanity checks */ if (!udc) @@ -1649,10 +1649,9 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) if (udc->driver) return -EBUSY; - if (!driver->bind || !driver->setup - || driver->speed < USB_SPEED_FULL) { + if (!bind || !driver->setup || driver->speed < USB_SPEED_FULL) { printk(KERN_ERR "Invalid driver: bind %p setup %p speed %d\n", - driver->bind, driver->setup, driver->speed); + bind, driver->setup, driver->speed); return -EINVAL; } #if defined(MODULE) @@ -1675,7 +1674,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) dprintk(DEBUG_NORMAL, "binding gadget driver '%s'\n", driver->driver.name); - if ((retval = driver->bind (&udc->gadget)) != 0) { + if ((retval = bind(&udc->gadget)) != 0) { device_del(&udc->gadget.dev); goto register_error; } @@ -1690,6 +1689,7 @@ register_error: udc->gadget.dev.driver = NULL; return retval; } +EXPORT_SYMBOL(usb_gadget_probe_driver); /* * usb_gadget_unregister_driver @@ -2049,7 +2049,6 @@ static void __exit udc_exit(void) } EXPORT_SYMBOL(usb_gadget_unregister_driver); -EXPORT_SYMBOL(usb_gadget_register_driver); module_init(udc_init); module_exit(udc_exit); -- cgit v1.2.2