aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/pxa25x_udc.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-06-28 09:33:47 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-06-28 14:13:35 -0400
commit0f91349b89f37dfad7b77f7829a105b6a0f526ec (patch)
tree4a2b109d3d736318913d0209a5f4ce89aaad1d24 /drivers/usb/gadget/pxa25x_udc.c
parent2ccea03a8f7ec93641791f2760d7cdc6cab6205f (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/pxa25x_udc.c')
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 774545494cf..e4e59b4de25 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -1011,12 +1011,18 @@ static int pxa25x_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
1011 return -EOPNOTSUPP; 1011 return -EOPNOTSUPP;
1012} 1012}
1013 1013
1014static int pxa25x_start(struct usb_gadget_driver *driver,
1015 int (*bind)(struct usb_gadget *));
1016static int pxa25x_stop(struct usb_gadget_driver *driver);
1017
1014static const struct usb_gadget_ops pxa25x_udc_ops = { 1018static const struct usb_gadget_ops pxa25x_udc_ops = {
1015 .get_frame = pxa25x_udc_get_frame, 1019 .get_frame = pxa25x_udc_get_frame,
1016 .wakeup = pxa25x_udc_wakeup, 1020 .wakeup = pxa25x_udc_wakeup,
1017 .vbus_session = pxa25x_udc_vbus_session, 1021 .vbus_session = pxa25x_udc_vbus_session,
1018 .pullup = pxa25x_udc_pullup, 1022 .pullup = pxa25x_udc_pullup,
1019 .vbus_draw = pxa25x_udc_vbus_draw, 1023 .vbus_draw = pxa25x_udc_vbus_draw,
1024 .start = pxa25x_start,
1025 .stop = pxa25x_stop,
1020}; 1026};
1021 1027
1022/*-------------------------------------------------------------------------*/ 1028/*-------------------------------------------------------------------------*/
@@ -1263,7 +1269,7 @@ static void udc_enable (struct pxa25x_udc *dev)
1263 * disconnect is reported. then a host may connect again, or 1269 * disconnect is reported. then a host may connect again, or
1264 * the driver might get unbound. 1270 * the driver might get unbound.
1265 */ 1271 */
1266int usb_gadget_probe_driver(struct usb_gadget_driver *driver, 1272static int pxa25x_start(struct usb_gadget_driver *driver,
1267 int (*bind)(struct usb_gadget *)) 1273 int (*bind)(struct usb_gadget *))
1268{ 1274{
1269 struct pxa25x_udc *dev = the_controller; 1275 struct pxa25x_udc *dev = the_controller;
@@ -1322,7 +1328,6 @@ fail:
1322bind_fail: 1328bind_fail:
1323 return retval; 1329 return retval;
1324} 1330}
1325EXPORT_SYMBOL(usb_gadget_probe_driver);
1326 1331
1327static void 1332static void
1328stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver) 1333stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver)
@@ -1351,7 +1356,7 @@ stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver)
1351 udc_reinit(dev); 1356 udc_reinit(dev);
1352} 1357}
1353 1358
1354int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1359static int pxa25x_stop(struct usb_gadget_driver *driver)
1355{ 1360{
1356 struct pxa25x_udc *dev = the_controller; 1361 struct pxa25x_udc *dev = the_controller;
1357 1362
@@ -1379,8 +1384,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1379 dump_state(dev); 1384 dump_state(dev);
1380 return 0; 1385 return 0;
1381} 1386}
1382EXPORT_SYMBOL(usb_gadget_unregister_driver);
1383
1384 1387
1385/*-------------------------------------------------------------------------*/ 1388/*-------------------------------------------------------------------------*/
1386 1389
@@ -2231,8 +2234,11 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2231#endif 2234#endif
2232 create_debug_files(dev); 2235 create_debug_files(dev);
2233 2236
2234 return 0; 2237 retval = usb_add_gadget_udc(&pdev->dev, &dev->gadget);
2238 if (!retval)
2239 return retval;
2235 2240
2241 remove_debug_files(dev);
2236#ifdef CONFIG_ARCH_LUBBOCK 2242#ifdef CONFIG_ARCH_LUBBOCK
2237lubbock_fail0: 2243lubbock_fail0:
2238 free_irq(LUBBOCK_USB_DISC_IRQ, dev); 2244 free_irq(LUBBOCK_USB_DISC_IRQ, dev);
@@ -2261,6 +2267,7 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
2261{ 2267{
2262 struct pxa25x_udc *dev = platform_get_drvdata(pdev); 2268 struct pxa25x_udc *dev = platform_get_drvdata(pdev);
2263 2269
2270 usb_del_gadget_udc(&dev->gadget);
2264 if (dev->driver) 2271 if (dev->driver)
2265 return -EBUSY; 2272 return -EBUSY;
2266 2273