aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
authorMichal Nazarewicz <m.nazarewicz@samsung.com>2010-08-12 11:43:54 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:21:25 -0400
commit07a18bd716ed5dea336429404b132568cfaaef95 (patch)
tree1ff7719e2e0e022cff3ed420bc1c332662a1a48c /drivers/usb/gadget/composite.c
parentb0fca50f5a94a268ed02cfddf44448051ed9343f (diff)
usb gadget: don't save bind callback in struct usb_composite_driver
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 composite driver structure. This fixes many section mismatches reported by modpost. Signed-off-by: Michał Nazarewicz <m.nazarewicz@samsung.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index a3009bf01229..c531a7e05f1e 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -40,6 +40,7 @@
40#define USB_BUFSIZ 1024 40#define USB_BUFSIZ 1024
41 41
42static struct usb_composite_driver *composite; 42static struct usb_composite_driver *composite;
43static int (*composite_gadget_bind)(struct usb_composite_dev *cdev);
43 44
44/* Some systems will need runtime overrides for the product identifers 45/* Some systems will need runtime overrides for the product identifers
45 * published in the device descriptor, either numbers or strings or both. 46 * published in the device descriptor, either numbers or strings or both.
@@ -1115,7 +1116,7 @@ static int composite_bind(struct usb_gadget *gadget)
1115 * serial number), register function drivers, potentially update 1116 * serial number), register function drivers, potentially update
1116 * power state and consumption, etc 1117 * power state and consumption, etc
1117 */ 1118 */
1118 status = composite->bind(cdev); 1119 status = composite_gadget_bind(cdev);
1119 if (status < 0) 1120 if (status < 0)
1120 goto fail; 1121 goto fail;
1121 1122
@@ -1227,8 +1228,12 @@ static struct usb_gadget_driver composite_driver = {
1227}; 1228};
1228 1229
1229/** 1230/**
1230 * usb_composite_register() - register a composite driver 1231 * usb_composite_probe() - register a composite driver
1231 * @driver: the driver to register 1232 * @driver: the driver to register
1233 * @bind: the callback used to allocate resources that are shared across the
1234 * whole device, such as string IDs, and add its configurations using
1235 * @usb_add_config(). This may fail by returning a negative errno
1236 * value; it should return zero on successful initialization.
1232 * Context: single threaded during gadget setup 1237 * Context: single threaded during gadget setup
1233 * 1238 *
1234 * This function is used to register drivers using the composite driver 1239 * This function is used to register drivers using the composite driver
@@ -1241,9 +1246,10 @@ static struct usb_gadget_driver composite_driver = {
1241 * while it was binding. That would usually be done in order to wait for 1246 * while it was binding. That would usually be done in order to wait for
1242 * some userspace participation. 1247 * some userspace participation.
1243 */ 1248 */
1244int usb_composite_register(struct usb_composite_driver *driver) 1249extern int usb_composite_probe(struct usb_composite_driver *driver,
1250 int (*bind)(struct usb_composite_dev *cdev))
1245{ 1251{
1246 if (!driver || !driver->dev || !driver->bind || composite) 1252 if (!driver || !driver->dev || !bind || composite)
1247 return -EINVAL; 1253 return -EINVAL;
1248 1254
1249 if (!driver->iProduct) 1255 if (!driver->iProduct)
@@ -1253,6 +1259,7 @@ int usb_composite_register(struct usb_composite_driver *driver)
1253 composite_driver.function = (char *) driver->name; 1259 composite_driver.function = (char *) driver->name;
1254 composite_driver.driver.name = driver->name; 1260 composite_driver.driver.name = driver->name;
1255 composite = driver; 1261 composite = driver;
1262 composite_gadget_bind = bind;
1256 1263
1257 return usb_gadget_probe_driver(&composite_driver, composite_bind); 1264 return usb_gadget_probe_driver(&composite_driver, composite_bind);
1258} 1265}