diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 15:20:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 15:20:00 -0500 |
commit | 74e1a2a39355b2d3ae8c60c78d8add162c6d7183 (patch) | |
tree | 1ce09f285c505a774838a95cff7327a750dc85fc /drivers/usb/gadget/fusb300_udc.c | |
parent | b5c78e04dd061b776978dad61dd85357081147b0 (diff) | |
parent | 6166805c3de539a41cfcae39026c5bc273d7c6aa (diff) |
Merge tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB patches from Greg Kroah-Hartman:
"Here's the big USB merge for 3.9-rc1
Nothing major, lots of gadget fixes, and of course, xhci stuff.
All of this has been in linux-next for a while, with the exception of
the last 3 patches, which were reverts of patches in the tree that
caused problems, they went in yesterday."
* tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (190 commits)
Revert "USB: EHCI: make ehci-vt8500 a separate driver"
Revert "USB: EHCI: make ehci-orion a separate driver"
Revert "USB: update host controller Kconfig entries"
USB: update host controller Kconfig entries
USB: EHCI: make ehci-orion a separate driver
USB: EHCI: make ehci-vt8500 a separate driver
USB: usb-storage: unusual_devs update for Super TOP SATA bridge
USB: ehci-omap: Fix autoloading of module
USB: ehci-omap: Don't free gpios that we didn't request
USB: option: add Huawei "ACM" devices using protocol = vendor
USB: serial: fix null-pointer dereferences on disconnect
USB: option: add Yota / Megafon M100-1 4g modem
drivers/usb: add missing GENERIC_HARDIRQS dependencies
USB: storage: properly handle the endian issues of idProduct
testusb: remove all mentions of 'usbfs'
usb: gadget: imx_udc: make it depend on BROKEN
usb: omap_control_usb: fix compile warning
ARM: OMAP: USB: Add phy binding information
ARM: OMAP2: MUSB: Specify omap4 has mailbox
ARM: OMAP: devices: create device for usb part of control module
...
Diffstat (limited to 'drivers/usb/gadget/fusb300_udc.c')
-rw-r--r-- | drivers/usb/gadget/fusb300_udc.c | 67 |
1 files changed, 19 insertions, 48 deletions
diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c index fc7cb09ab52b..066cb89376de 100644 --- a/drivers/usb/gadget/fusb300_udc.c +++ b/drivers/usb/gadget/fusb300_udc.c | |||
@@ -1308,65 +1308,28 @@ static void init_controller(struct fusb300 *fusb300) | |||
1308 | iowrite32(0xcfffff9f, fusb300->reg + FUSB300_OFFSET_IGER1); | 1308 | iowrite32(0xcfffff9f, fusb300->reg + FUSB300_OFFSET_IGER1); |
1309 | } | 1309 | } |
1310 | /*------------------------------------------------------------------------*/ | 1310 | /*------------------------------------------------------------------------*/ |
1311 | static struct fusb300 *the_controller; | 1311 | static int fusb300_udc_start(struct usb_gadget *g, |
1312 | 1312 | struct usb_gadget_driver *driver) | |
1313 | static int fusb300_udc_start(struct usb_gadget_driver *driver, | ||
1314 | int (*bind)(struct usb_gadget *, struct usb_gadget_driver *)) | ||
1315 | { | 1313 | { |
1316 | struct fusb300 *fusb300 = the_controller; | 1314 | struct fusb300 *fusb300 = to_fusb300(g); |
1317 | int retval; | ||
1318 | |||
1319 | if (!driver | ||
1320 | || driver->max_speed < USB_SPEED_FULL | ||
1321 | || !bind | ||
1322 | || !driver->setup) | ||
1323 | return -EINVAL; | ||
1324 | |||
1325 | if (!fusb300) | ||
1326 | return -ENODEV; | ||
1327 | |||
1328 | if (fusb300->driver) | ||
1329 | return -EBUSY; | ||
1330 | 1315 | ||
1331 | /* hook up the driver */ | 1316 | /* hook up the driver */ |
1332 | driver->driver.bus = NULL; | 1317 | driver->driver.bus = NULL; |
1333 | fusb300->driver = driver; | 1318 | fusb300->driver = driver; |
1334 | fusb300->gadget.dev.driver = &driver->driver; | 1319 | fusb300->gadget.dev.driver = &driver->driver; |
1335 | 1320 | ||
1336 | retval = device_add(&fusb300->gadget.dev); | ||
1337 | if (retval) { | ||
1338 | pr_err("device_add error (%d)\n", retval); | ||
1339 | goto error; | ||
1340 | } | ||
1341 | |||
1342 | retval = bind(&fusb300->gadget, driver); | ||
1343 | if (retval) { | ||
1344 | pr_err("bind to driver error (%d)\n", retval); | ||
1345 | device_del(&fusb300->gadget.dev); | ||
1346 | goto error; | ||
1347 | } | ||
1348 | |||
1349 | return 0; | 1321 | return 0; |
1350 | |||
1351 | error: | ||
1352 | fusb300->driver = NULL; | ||
1353 | fusb300->gadget.dev.driver = NULL; | ||
1354 | |||
1355 | return retval; | ||
1356 | } | 1322 | } |
1357 | 1323 | ||
1358 | static int fusb300_udc_stop(struct usb_gadget_driver *driver) | 1324 | static int fusb300_udc_stop(struct usb_gadget *g, |
1325 | struct usb_gadget_driver *driver) | ||
1359 | { | 1326 | { |
1360 | struct fusb300 *fusb300 = the_controller; | 1327 | struct fusb300 *fusb300 = to_fusb300(g); |
1361 | |||
1362 | if (driver != fusb300->driver || !driver->unbind) | ||
1363 | return -EINVAL; | ||
1364 | 1328 | ||
1365 | driver->unbind(&fusb300->gadget); | 1329 | driver->unbind(&fusb300->gadget); |
1366 | fusb300->gadget.dev.driver = NULL; | 1330 | fusb300->gadget.dev.driver = NULL; |
1367 | 1331 | ||
1368 | init_controller(fusb300); | 1332 | init_controller(fusb300); |
1369 | device_del(&fusb300->gadget.dev); | ||
1370 | fusb300->driver = NULL; | 1333 | fusb300->driver = NULL; |
1371 | 1334 | ||
1372 | return 0; | 1335 | return 0; |
@@ -1378,10 +1341,10 @@ static int fusb300_udc_pullup(struct usb_gadget *_gadget, int is_active) | |||
1378 | return 0; | 1341 | return 0; |
1379 | } | 1342 | } |
1380 | 1343 | ||
1381 | static struct usb_gadget_ops fusb300_gadget_ops = { | 1344 | static const struct usb_gadget_ops fusb300_gadget_ops = { |
1382 | .pullup = fusb300_udc_pullup, | 1345 | .pullup = fusb300_udc_pullup, |
1383 | .start = fusb300_udc_start, | 1346 | .udc_start = fusb300_udc_start, |
1384 | .stop = fusb300_udc_stop, | 1347 | .udc_stop = fusb300_udc_stop, |
1385 | }; | 1348 | }; |
1386 | 1349 | ||
1387 | static int __exit fusb300_remove(struct platform_device *pdev) | 1350 | static int __exit fusb300_remove(struct platform_device *pdev) |
@@ -1505,8 +1468,6 @@ static int __init fusb300_probe(struct platform_device *pdev) | |||
1505 | fusb300->gadget.ep0 = &fusb300->ep[0]->ep; | 1468 | fusb300->gadget.ep0 = &fusb300->ep[0]->ep; |
1506 | INIT_LIST_HEAD(&fusb300->gadget.ep0->ep_list); | 1469 | INIT_LIST_HEAD(&fusb300->gadget.ep0->ep_list); |
1507 | 1470 | ||
1508 | the_controller = fusb300; | ||
1509 | |||
1510 | fusb300->ep0_req = fusb300_alloc_request(&fusb300->ep[0]->ep, | 1471 | fusb300->ep0_req = fusb300_alloc_request(&fusb300->ep[0]->ep, |
1511 | GFP_KERNEL); | 1472 | GFP_KERNEL); |
1512 | if (fusb300->ep0_req == NULL) | 1473 | if (fusb300->ep0_req == NULL) |
@@ -1517,9 +1478,19 @@ static int __init fusb300_probe(struct platform_device *pdev) | |||
1517 | if (ret) | 1478 | if (ret) |
1518 | goto err_add_udc; | 1479 | goto err_add_udc; |
1519 | 1480 | ||
1481 | ret = device_add(&fusb300->gadget.dev); | ||
1482 | if (ret) { | ||
1483 | pr_err("device_add error (%d)\n", ret); | ||
1484 | goto err_add_device; | ||
1485 | } | ||
1486 | |||
1520 | dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION); | 1487 | dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION); |
1521 | 1488 | ||
1522 | return 0; | 1489 | return 0; |
1490 | |||
1491 | err_add_device: | ||
1492 | usb_del_gadget_udc(&fusb300->gadget); | ||
1493 | |||
1523 | err_add_udc: | 1494 | err_add_udc: |
1524 | fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req); | 1495 | fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req); |
1525 | 1496 | ||