diff options
Diffstat (limited to 'drivers/usb/gadget/imx_udc.c')
-rw-r--r-- | drivers/usb/gadget/imx_udc.c | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c index 8d1c75abd73d..54034f84f992 100644 --- a/drivers/usb/gadget/imx_udc.c +++ b/drivers/usb/gadget/imx_udc.c | |||
@@ -1237,14 +1237,15 @@ irq_handler_t intr_handler(int i) | |||
1237 | ******************************************************************************* | 1237 | ******************************************************************************* |
1238 | */ | 1238 | */ |
1239 | 1239 | ||
1240 | static int imx_udc_start(struct usb_gadget_driver *driver, | 1240 | static int imx_udc_start(struct usb_gadget *gadget, |
1241 | int (*bind)(struct usb_gadget *)); | 1241 | struct usb_gadget_driver *driver); |
1242 | static int imx_udc_stop(struct usb_gadget_driver *driver); | 1242 | static int imx_udc_stop(struct usb_gadget *gadget, |
1243 | struct usb_gadget_driver *driver); | ||
1243 | static const struct usb_gadget_ops imx_udc_ops = { | 1244 | static const struct usb_gadget_ops imx_udc_ops = { |
1244 | .get_frame = imx_udc_get_frame, | 1245 | .get_frame = imx_udc_get_frame, |
1245 | .wakeup = imx_udc_wakeup, | 1246 | .wakeup = imx_udc_wakeup, |
1246 | .start = imx_udc_start, | 1247 | .udc_start = imx_udc_start, |
1247 | .stop = imx_udc_stop, | 1248 | .udc_stop = imx_udc_stop, |
1248 | }; | 1249 | }; |
1249 | 1250 | ||
1250 | static struct imx_udc_struct controller = { | 1251 | static struct imx_udc_struct controller = { |
@@ -1329,23 +1330,13 @@ static struct imx_udc_struct controller = { | |||
1329 | * USB gadget driver functions | 1330 | * USB gadget driver functions |
1330 | ******************************************************************************* | 1331 | ******************************************************************************* |
1331 | */ | 1332 | */ |
1332 | static int imx_udc_start(struct usb_gadget_driver *driver, | 1333 | static int imx_udc_start(struct usb_gadget *gadget, |
1333 | int (*bind)(struct usb_gadget *)) | 1334 | struct usb_gadget_driver *driver) |
1334 | { | 1335 | { |
1335 | struct imx_udc_struct *imx_usb = &controller; | 1336 | struct imx_udc_struct *imx_usb; |
1336 | int retval; | 1337 | int retval; |
1337 | 1338 | ||
1338 | if (!driver | 1339 | imx_usb = container_of(gadget, struct imx_udc_struct, gadget); |
1339 | || driver->max_speed < USB_SPEED_FULL | ||
1340 | || !bind | ||
1341 | || !driver->disconnect | ||
1342 | || !driver->setup) | ||
1343 | return -EINVAL; | ||
1344 | if (!imx_usb) | ||
1345 | return -ENODEV; | ||
1346 | if (imx_usb->driver) | ||
1347 | return -EBUSY; | ||
1348 | |||
1349 | /* first hook up the driver ... */ | 1340 | /* first hook up the driver ... */ |
1350 | imx_usb->driver = driver; | 1341 | imx_usb->driver = driver; |
1351 | imx_usb->gadget.dev.driver = &driver->driver; | 1342 | imx_usb->gadget.dev.driver = &driver->driver; |
@@ -1353,14 +1344,6 @@ static int imx_udc_start(struct usb_gadget_driver *driver, | |||
1353 | retval = device_add(&imx_usb->gadget.dev); | 1344 | retval = device_add(&imx_usb->gadget.dev); |
1354 | if (retval) | 1345 | if (retval) |
1355 | goto fail; | 1346 | goto fail; |
1356 | retval = bind(&imx_usb->gadget); | ||
1357 | if (retval) { | ||
1358 | D_ERR(imx_usb->dev, "<%s> bind to driver %s --> error %d\n", | ||
1359 | __func__, driver->driver.name, retval); | ||
1360 | device_del(&imx_usb->gadget.dev); | ||
1361 | |||
1362 | goto fail; | ||
1363 | } | ||
1364 | 1347 | ||
1365 | D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n", | 1348 | D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n", |
1366 | __func__, driver->driver.name); | 1349 | __func__, driver->driver.name); |
@@ -1374,20 +1357,16 @@ fail: | |||
1374 | return retval; | 1357 | return retval; |
1375 | } | 1358 | } |
1376 | 1359 | ||
1377 | static int imx_udc_stop(struct usb_gadget_driver *driver) | 1360 | static int imx_udc_stop(struct usb_gadget *gadget, |
1361 | struct usb_gadget_driver *driver) | ||
1378 | { | 1362 | { |
1379 | struct imx_udc_struct *imx_usb = &controller; | 1363 | struct imx_udc_struct *imx_usb = container_of(gadget, |
1380 | 1364 | struct imx_udc_struct, gadget); | |
1381 | if (!imx_usb) | ||
1382 | return -ENODEV; | ||
1383 | if (!driver || driver != imx_usb->driver || !driver->unbind) | ||
1384 | return -EINVAL; | ||
1385 | 1365 | ||
1386 | udc_stop_activity(imx_usb, driver); | 1366 | udc_stop_activity(imx_usb, driver); |
1387 | imx_udc_disable(imx_usb); | 1367 | imx_udc_disable(imx_usb); |
1388 | del_timer(&imx_usb->timer); | 1368 | del_timer(&imx_usb->timer); |
1389 | 1369 | ||
1390 | driver->unbind(&imx_usb->gadget); | ||
1391 | imx_usb->gadget.dev.driver = NULL; | 1370 | imx_usb->gadget.dev.driver = NULL; |
1392 | imx_usb->driver = NULL; | 1371 | imx_usb->driver = NULL; |
1393 | 1372 | ||