aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/pxa27x_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/pxa27x_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/pxa27x_udc.c')
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 57607696735c..85b68c75dc9d 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1680,12 +1680,18 @@ static int pxa_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
1680 return -EOPNOTSUPP; 1680 return -EOPNOTSUPP;
1681} 1681}
1682 1682
1683static int pxa27x_udc_start(struct usb_gadget_driver *driver,
1684 int (*bind)(struct usb_gadget *));
1685static int pxa27x_udc_stop(struct usb_gadget_driver *driver);
1686
1683static const struct usb_gadget_ops pxa_udc_ops = { 1687static const struct usb_gadget_ops pxa_udc_ops = {
1684 .get_frame = pxa_udc_get_frame, 1688 .get_frame = pxa_udc_get_frame,
1685 .wakeup = pxa_udc_wakeup, 1689 .wakeup = pxa_udc_wakeup,
1686 .pullup = pxa_udc_pullup, 1690 .pullup = pxa_udc_pullup,
1687 .vbus_session = pxa_udc_vbus_session, 1691 .vbus_session = pxa_udc_vbus_session,
1688 .vbus_draw = pxa_udc_vbus_draw, 1692 .vbus_draw = pxa_udc_vbus_draw,
1693 .start = pxa27x_udc_start,
1694 .stop = pxa27x_udc_stop,
1689}; 1695};
1690 1696
1691/** 1697/**
@@ -1791,7 +1797,7 @@ static void udc_enable(struct pxa_udc *udc)
1791} 1797}
1792 1798
1793/** 1799/**
1794 * usb_gadget_probe_driver - Register gadget driver 1800 * pxa27x_start - Register gadget driver
1795 * @driver: gadget driver 1801 * @driver: gadget driver
1796 * @bind: bind function 1802 * @bind: bind function
1797 * 1803 *
@@ -1805,7 +1811,7 @@ static void udc_enable(struct pxa_udc *udc)
1805 * 1811 *
1806 * Returns 0 if no error, -EINVAL, -ENODEV, -EBUSY otherwise 1812 * Returns 0 if no error, -EINVAL, -ENODEV, -EBUSY otherwise
1807 */ 1813 */
1808int usb_gadget_probe_driver(struct usb_gadget_driver *driver, 1814static int pxa27x_udc_start(struct usb_gadget_driver *driver,
1809 int (*bind)(struct usb_gadget *)) 1815 int (*bind)(struct usb_gadget *))
1810{ 1816{
1811 struct pxa_udc *udc = the_controller; 1817 struct pxa_udc *udc = the_controller;
@@ -1860,8 +1866,6 @@ add_fail:
1860 udc->gadget.dev.driver = NULL; 1866 udc->gadget.dev.driver = NULL;
1861 return retval; 1867 return retval;
1862} 1868}
1863EXPORT_SYMBOL(usb_gadget_probe_driver);
1864
1865 1869
1866/** 1870/**
1867 * stop_activity - Stops udc endpoints 1871 * stop_activity - Stops udc endpoints
@@ -1888,12 +1892,12 @@ static void stop_activity(struct pxa_udc *udc, struct usb_gadget_driver *driver)
1888} 1892}
1889 1893
1890/** 1894/**
1891 * usb_gadget_unregister_driver - Unregister the gadget driver 1895 * pxa27x_udc_stop - Unregister the gadget driver
1892 * @driver: gadget driver 1896 * @driver: gadget driver
1893 * 1897 *
1894 * Returns 0 if no error, -ENODEV, -EINVAL otherwise 1898 * Returns 0 if no error, -ENODEV, -EINVAL otherwise
1895 */ 1899 */
1896int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1900static int pxa27x_udc_stop(struct usb_gadget_driver *driver)
1897{ 1901{
1898 struct pxa_udc *udc = the_controller; 1902 struct pxa_udc *udc = the_controller;
1899 1903
@@ -1917,7 +1921,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1917 return otg_set_peripheral(udc->transceiver, NULL); 1921 return otg_set_peripheral(udc->transceiver, NULL);
1918 return 0; 1922 return 0;
1919} 1923}
1920EXPORT_SYMBOL(usb_gadget_unregister_driver);
1921 1924
1922/** 1925/**
1923 * handle_ep0_ctrl_req - handle control endpoint control request 1926 * handle_ep0_ctrl_req - handle control endpoint control request
@@ -2516,9 +2519,14 @@ static int __init pxa_udc_probe(struct platform_device *pdev)
2516 driver_name, IRQ_USB, retval); 2519 driver_name, IRQ_USB, retval);
2517 goto err_irq; 2520 goto err_irq;
2518 } 2521 }
2522 retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget);
2523 if (retval)
2524 goto err_add_udc;
2519 2525
2520 pxa_init_debugfs(udc); 2526 pxa_init_debugfs(udc);
2521 return 0; 2527 return 0;
2528err_add_udc:
2529 free_irq(udc->irq, udc);
2522err_irq: 2530err_irq:
2523 iounmap(udc->regs); 2531 iounmap(udc->regs);
2524err_map: 2532err_map:
@@ -2537,6 +2545,7 @@ static int __exit pxa_udc_remove(struct platform_device *_dev)
2537 struct pxa_udc *udc = platform_get_drvdata(_dev); 2545 struct pxa_udc *udc = platform_get_drvdata(_dev);
2538 int gpio = udc->mach->gpio_pullup; 2546 int gpio = udc->mach->gpio_pullup;
2539 2547
2548 usb_del_gadget_udc(&udc->gadget);
2540 usb_gadget_unregister_driver(udc->driver); 2549 usb_gadget_unregister_driver(udc->driver);
2541 free_irq(udc->irq, udc); 2550 free_irq(udc->irq, udc);
2542 pxa_cleanup_debugfs(udc); 2551 pxa_cleanup_debugfs(udc);