aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/net2280.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/net2280.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/net2280.c')
-rw-r--r--drivers/usb/gadget/net2280.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 476d88e1ae9..1e6ea6f2650 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -1410,11 +1410,17 @@ static int net2280_pullup(struct usb_gadget *_gadget, int is_on)
1410 return 0; 1410 return 0;
1411} 1411}
1412 1412
1413static int net2280_start(struct usb_gadget_driver *driver,
1414 int (*bind)(struct usb_gadget *));
1415static int net2280_stop(struct usb_gadget_driver *driver);
1416
1413static const struct usb_gadget_ops net2280_ops = { 1417static const struct usb_gadget_ops net2280_ops = {
1414 .get_frame = net2280_get_frame, 1418 .get_frame = net2280_get_frame,
1415 .wakeup = net2280_wakeup, 1419 .wakeup = net2280_wakeup,
1416 .set_selfpowered = net2280_set_selfpowered, 1420 .set_selfpowered = net2280_set_selfpowered,
1417 .pullup = net2280_pullup, 1421 .pullup = net2280_pullup,
1422 .start = net2280_start,
1423 .stop = net2280_stop,
1418}; 1424};
1419 1425
1420/*-------------------------------------------------------------------------*/ 1426/*-------------------------------------------------------------------------*/
@@ -1930,7 +1936,7 @@ static void ep0_start (struct net2280 *dev)
1930 * disconnect is reported. then a host may connect again, or 1936 * disconnect is reported. then a host may connect again, or
1931 * the driver might get unbound. 1937 * the driver might get unbound.
1932 */ 1938 */
1933int usb_gadget_probe_driver(struct usb_gadget_driver *driver, 1939static int net2280_start(struct usb_gadget_driver *driver,
1934 int (*bind)(struct usb_gadget *)) 1940 int (*bind)(struct usb_gadget *))
1935{ 1941{
1936 struct net2280 *dev = the_controller; 1942 struct net2280 *dev = the_controller;
@@ -1994,7 +2000,6 @@ err_unbind:
1994 dev->driver = NULL; 2000 dev->driver = NULL;
1995 return retval; 2001 return retval;
1996} 2002}
1997EXPORT_SYMBOL(usb_gadget_probe_driver);
1998 2003
1999static void 2004static void
2000stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver) 2005stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver)
@@ -2022,7 +2027,7 @@ stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver)
2022 usb_reinit (dev); 2027 usb_reinit (dev);
2023} 2028}
2024 2029
2025int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) 2030static int net2280_stop(struct usb_gadget_driver *driver)
2026{ 2031{
2027 struct net2280 *dev = the_controller; 2032 struct net2280 *dev = the_controller;
2028 unsigned long flags; 2033 unsigned long flags;
@@ -2049,8 +2054,6 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
2049 DEBUG (dev, "unregistered driver '%s'\n", driver->driver.name); 2054 DEBUG (dev, "unregistered driver '%s'\n", driver->driver.name);
2050 return 0; 2055 return 0;
2051} 2056}
2052EXPORT_SYMBOL (usb_gadget_unregister_driver);
2053
2054 2057
2055/*-------------------------------------------------------------------------*/ 2058/*-------------------------------------------------------------------------*/
2056 2059
@@ -2732,6 +2735,8 @@ static void net2280_remove (struct pci_dev *pdev)
2732{ 2735{
2733 struct net2280 *dev = pci_get_drvdata (pdev); 2736 struct net2280 *dev = pci_get_drvdata (pdev);
2734 2737
2738 usb_del_gadget_udc(&dev->gadget);
2739
2735 BUG_ON(dev->driver); 2740 BUG_ON(dev->driver);
2736 2741
2737 /* then clean up the resources we allocated during probe() */ 2742 /* then clean up the resources we allocated during probe() */
@@ -2916,6 +2921,9 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
2916 retval = device_create_file (&pdev->dev, &dev_attr_registers); 2921 retval = device_create_file (&pdev->dev, &dev_attr_registers);
2917 if (retval) goto done; 2922 if (retval) goto done;
2918 2923
2924 retval = usb_add_gadget_udc(&pdev->dev, &dev->gadget);
2925 if (retval)
2926 goto done;
2919 return 0; 2927 return 0;
2920 2928
2921done: 2929done: