diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2011-06-28 09:33:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-06-28 14:13:35 -0400 |
commit | 0f91349b89f37dfad7b77f7829a105b6a0f526ec (patch) | |
tree | 4a2b109d3d736318913d0209a5f4ce89aaad1d24 /drivers/usb/gadget/imx_udc.c | |
parent | 2ccea03a8f7ec93641791f2760d7cdc6cab6205f (diff) |
usb: gadget: convert all users to the new udc infrastructure
peripheral drivers are using usb_add_gadget()/usb_del_gadget() to
register/unregister to the udc-core.
The udc-core will take the first available gadget driver and attach
function driver which is calling usb_gadget_register_driver(). This is
the same behaviour we have right now.
Only dummy_hcd was tested, the others were compiled tested.
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Anton Tikhomirov <av.tikhomirov@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Dan Carpenter <error27@gmail.com>
Cc: Darius Augulis <augulis.darius@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Li Yang <leoli@freescale.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Cc: Roy Huang <roy.huang@analog.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Toshiharu Okada <toshiharu-linux@dsn.okisemi.com>
Cc: Xiaochen Shen <xiaochen.shen@intel.com>
Cc: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Cc: Yuan-Hsin Chen <yhchen@faraday-tech.com>
Cc: cxie4 <cxie4@marvell.com>
Cc: linux-geode@lists.infradead.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/imx_udc.c')
-rw-r--r-- | drivers/usb/gadget/imx_udc.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c index ade40066decf..692fd9b2248b 100644 --- a/drivers/usb/gadget/imx_udc.c +++ b/drivers/usb/gadget/imx_udc.c | |||
@@ -1237,9 +1237,14 @@ irq_handler_t intr_handler(int i) | |||
1237 | ******************************************************************************* | 1237 | ******************************************************************************* |
1238 | */ | 1238 | */ |
1239 | 1239 | ||
1240 | static int imx_udc_start(struct usb_gadget_driver *driver, | ||
1241 | int (*bind)(struct usb_gadget *)); | ||
1242 | static int imx_udc_stop(struct usb_gadget_driver *driver); | ||
1240 | static const struct usb_gadget_ops imx_udc_ops = { | 1243 | static const struct usb_gadget_ops imx_udc_ops = { |
1241 | .get_frame = imx_udc_get_frame, | 1244 | .get_frame = imx_udc_get_frame, |
1242 | .wakeup = imx_udc_wakeup, | 1245 | .wakeup = imx_udc_wakeup, |
1246 | .start = imx_udc_start, | ||
1247 | .stop = imx_udc_stop, | ||
1243 | }; | 1248 | }; |
1244 | 1249 | ||
1245 | static struct imx_udc_struct controller = { | 1250 | static struct imx_udc_struct controller = { |
@@ -1324,7 +1329,7 @@ static struct imx_udc_struct controller = { | |||
1324 | * USB gadget driver functions | 1329 | * USB gadget driver functions |
1325 | ******************************************************************************* | 1330 | ******************************************************************************* |
1326 | */ | 1331 | */ |
1327 | int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | 1332 | static int imx_udc_start(struct usb_gadget_driver *driver, |
1328 | int (*bind)(struct usb_gadget *)) | 1333 | int (*bind)(struct usb_gadget *)) |
1329 | { | 1334 | { |
1330 | struct imx_udc_struct *imx_usb = &controller; | 1335 | struct imx_udc_struct *imx_usb = &controller; |
@@ -1368,9 +1373,8 @@ fail: | |||
1368 | imx_usb->gadget.dev.driver = NULL; | 1373 | imx_usb->gadget.dev.driver = NULL; |
1369 | return retval; | 1374 | return retval; |
1370 | } | 1375 | } |
1371 | EXPORT_SYMBOL(usb_gadget_probe_driver); | ||
1372 | 1376 | ||
1373 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | 1377 | static int imx_udc_stop(struct usb_gadget_driver *driver) |
1374 | { | 1378 | { |
1375 | struct imx_udc_struct *imx_usb = &controller; | 1379 | struct imx_udc_struct *imx_usb = &controller; |
1376 | 1380 | ||
@@ -1394,7 +1398,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1394 | 1398 | ||
1395 | return 0; | 1399 | return 0; |
1396 | } | 1400 | } |
1397 | EXPORT_SYMBOL(usb_gadget_unregister_driver); | ||
1398 | 1401 | ||
1399 | /******************************************************************************* | 1402 | /******************************************************************************* |
1400 | * Module functions | 1403 | * Module functions |
@@ -1504,8 +1507,14 @@ static int __init imx_udc_probe(struct platform_device *pdev) | |||
1504 | imx_usb->timer.function = handle_config; | 1507 | imx_usb->timer.function = handle_config; |
1505 | imx_usb->timer.data = (unsigned long)imx_usb; | 1508 | imx_usb->timer.data = (unsigned long)imx_usb; |
1506 | 1509 | ||
1507 | return 0; | 1510 | ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget); |
1511 | if (ret) | ||
1512 | goto fail4; | ||
1508 | 1513 | ||
1514 | return 0; | ||
1515 | fail4: | ||
1516 | for (i = 0; i < IMX_USB_NB_EP + 1; i++) | ||
1517 | free_irq(imx_usb->usbd_int[i], imx_usb); | ||
1509 | fail3: | 1518 | fail3: |
1510 | clk_put(clk); | 1519 | clk_put(clk); |
1511 | clk_disable(clk); | 1520 | clk_disable(clk); |
@@ -1525,6 +1534,7 @@ static int __exit imx_udc_remove(struct platform_device *pdev) | |||
1525 | struct imxusb_platform_data *pdata = pdev->dev.platform_data; | 1534 | struct imxusb_platform_data *pdata = pdev->dev.platform_data; |
1526 | int i; | 1535 | int i; |
1527 | 1536 | ||
1537 | usb_del_gadget_udc(&imx_usb->gadget); | ||
1528 | imx_udc_disable(imx_usb); | 1538 | imx_udc_disable(imx_usb); |
1529 | del_timer(&imx_usb->timer); | 1539 | del_timer(&imx_usb->timer); |
1530 | 1540 | ||