aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
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/musb
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/musb')
-rw-r--r--drivers/usb/musb/musb_gadget.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 0a50a35e1853..728572cf709c 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1704,6 +1704,10 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on)
1704 return 0; 1704 return 0;
1705} 1705}
1706 1706
1707static int musb_gadget_start(struct usb_gadget_driver *driver,
1708 int (*bind)(struct usb_gadget *));
1709static int musb_gadget_stop(struct usb_gadget_driver *driver);
1710
1707static const struct usb_gadget_ops musb_gadget_operations = { 1711static const struct usb_gadget_ops musb_gadget_operations = {
1708 .get_frame = musb_gadget_get_frame, 1712 .get_frame = musb_gadget_get_frame,
1709 .wakeup = musb_gadget_wakeup, 1713 .wakeup = musb_gadget_wakeup,
@@ -1711,6 +1715,8 @@ static const struct usb_gadget_ops musb_gadget_operations = {
1711 /* .vbus_session = musb_gadget_vbus_session, */ 1715 /* .vbus_session = musb_gadget_vbus_session, */
1712 .vbus_draw = musb_gadget_vbus_draw, 1716 .vbus_draw = musb_gadget_vbus_draw,
1713 .pullup = musb_gadget_pullup, 1717 .pullup = musb_gadget_pullup,
1718 .start = musb_gadget_start,
1719 .stop = musb_gadget_stop,
1714}; 1720};
1715 1721
1716/* ----------------------------------------------------------------------- */ 1722/* ----------------------------------------------------------------------- */
@@ -1835,7 +1841,16 @@ int __init musb_gadget_setup(struct musb *musb)
1835 if (status != 0) { 1841 if (status != 0) {
1836 put_device(&musb->g.dev); 1842 put_device(&musb->g.dev);
1837 the_gadget = NULL; 1843 the_gadget = NULL;
1844 return status;
1838 } 1845 }
1846 status = usb_add_gadget_udc(musb->controller, &musb->g);
1847 if (status)
1848 goto err;
1849
1850 return 0;
1851err:
1852 device_unregister(&musb->g.dev);
1853 the_gadget = NULL;
1839 return status; 1854 return status;
1840} 1855}
1841 1856
@@ -1844,6 +1859,7 @@ void musb_gadget_cleanup(struct musb *musb)
1844 if (musb != the_gadget) 1859 if (musb != the_gadget)
1845 return; 1860 return;
1846 1861
1862 usb_del_gadget_udc(&musb->g);
1847 device_unregister(&musb->g.dev); 1863 device_unregister(&musb->g.dev);
1848 the_gadget = NULL; 1864 the_gadget = NULL;
1849} 1865}
@@ -1860,7 +1876,7 @@ void musb_gadget_cleanup(struct musb *musb)
1860 * @param bind the driver's bind function 1876 * @param bind the driver's bind function
1861 * @return <0 if error, 0 if everything is fine 1877 * @return <0 if error, 0 if everything is fine
1862 */ 1878 */
1863int usb_gadget_probe_driver(struct usb_gadget_driver *driver, 1879static int musb_gadget_start(struct usb_gadget_driver *driver,
1864 int (*bind)(struct usb_gadget *)) 1880 int (*bind)(struct usb_gadget *))
1865{ 1881{
1866 struct musb *musb = the_gadget; 1882 struct musb *musb = the_gadget;
@@ -1962,7 +1978,6 @@ err1:
1962err0: 1978err0:
1963 return retval; 1979 return retval;
1964} 1980}
1965EXPORT_SYMBOL(usb_gadget_probe_driver);
1966 1981
1967static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver) 1982static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver)
1968{ 1983{
@@ -2012,7 +2027,7 @@ static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver)
2012 * 2027 *
2013 * @param driver the gadget driver to unregister 2028 * @param driver the gadget driver to unregister
2014 */ 2029 */
2015int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 2030static int musb_gadget_stop(struct usb_gadget_driver *driver)
2016{ 2031{
2017 struct musb *musb = the_gadget; 2032 struct musb *musb = the_gadget;
2018 unsigned long flags; 2033 unsigned long flags;
@@ -2071,8 +2086,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
2071 2086
2072 return 0; 2087 return 0;
2073} 2088}
2074EXPORT_SYMBOL(usb_gadget_unregister_driver);
2075
2076 2089
2077/* ----------------------------------------------------------------------- */ 2090/* ----------------------------------------------------------------------- */
2078 2091