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/net2272.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/net2272.c')
-rw-r--r-- | drivers/usb/gadget/net2272.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index 29151c44f476..7f1219e239a3 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
@@ -1172,11 +1172,17 @@ net2272_pullup(struct usb_gadget *_gadget, int is_on) | |||
1172 | return 0; | 1172 | return 0; |
1173 | } | 1173 | } |
1174 | 1174 | ||
1175 | static int net2272_start(struct usb_gadget_driver *driver, | ||
1176 | int (*bind)(struct usb_gadget *)); | ||
1177 | static int net2272_stop(struct usb_gadget_driver *driver); | ||
1178 | |||
1175 | static const struct usb_gadget_ops net2272_ops = { | 1179 | static const struct usb_gadget_ops net2272_ops = { |
1176 | .get_frame = net2272_get_frame, | 1180 | .get_frame = net2272_get_frame, |
1177 | .wakeup = net2272_wakeup, | 1181 | .wakeup = net2272_wakeup, |
1178 | .set_selfpowered = net2272_set_selfpowered, | 1182 | .set_selfpowered = net2272_set_selfpowered, |
1179 | .pullup = net2272_pullup | 1183 | .pullup = net2272_pullup, |
1184 | .start = net2272_start, | ||
1185 | .stop = net2272_stop, | ||
1180 | }; | 1186 | }; |
1181 | 1187 | ||
1182 | /*---------------------------------------------------------------------------*/ | 1188 | /*---------------------------------------------------------------------------*/ |
@@ -1447,7 +1453,7 @@ net2272_ep0_start(struct net2272 *dev) | |||
1447 | * disconnect is reported. then a host may connect again, or | 1453 | * disconnect is reported. then a host may connect again, or |
1448 | * the driver might get unbound. | 1454 | * the driver might get unbound. |
1449 | */ | 1455 | */ |
1450 | int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | 1456 | static int net2272_start(struct usb_gadget_driver *driver, |
1451 | int (*bind)(struct usb_gadget *)) | 1457 | int (*bind)(struct usb_gadget *)) |
1452 | { | 1458 | { |
1453 | struct net2272 *dev = the_controller; | 1459 | struct net2272 *dev = the_controller; |
@@ -1487,7 +1493,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1487 | 1493 | ||
1488 | return 0; | 1494 | return 0; |
1489 | } | 1495 | } |
1490 | EXPORT_SYMBOL(usb_gadget_probe_driver); | ||
1491 | 1496 | ||
1492 | static void | 1497 | static void |
1493 | stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver) | 1498 | stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver) |
@@ -1515,7 +1520,7 @@ stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver) | |||
1515 | net2272_usb_reinit(dev); | 1520 | net2272_usb_reinit(dev); |
1516 | } | 1521 | } |
1517 | 1522 | ||
1518 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | 1523 | static int net2272_stop(struct usb_gadget_driver *driver) |
1519 | { | 1524 | { |
1520 | struct net2272 *dev = the_controller; | 1525 | struct net2272 *dev = the_controller; |
1521 | unsigned long flags; | 1526 | unsigned long flags; |
@@ -1538,7 +1543,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1538 | dev_dbg(dev->dev, "unregistered driver '%s'\n", driver->driver.name); | 1543 | dev_dbg(dev->dev, "unregistered driver '%s'\n", driver->driver.name); |
1539 | return 0; | 1544 | return 0; |
1540 | } | 1545 | } |
1541 | EXPORT_SYMBOL(usb_gadget_unregister_driver); | ||
1542 | 1546 | ||
1543 | /*---------------------------------------------------------------------------*/ | 1547 | /*---------------------------------------------------------------------------*/ |
1544 | /* handle ep-a/ep-b dma completions */ | 1548 | /* handle ep-a/ep-b dma completions */ |
@@ -2217,6 +2221,8 @@ net2272_gadget_release(struct device *_dev) | |||
2217 | static void __devexit | 2221 | static void __devexit |
2218 | net2272_remove(struct net2272 *dev) | 2222 | net2272_remove(struct net2272 *dev) |
2219 | { | 2223 | { |
2224 | usb_del_gadget_udc(&dev->gadget); | ||
2225 | |||
2220 | /* start with the driver above us */ | 2226 | /* start with the driver above us */ |
2221 | if (dev->driver) { | 2227 | if (dev->driver) { |
2222 | /* should have been done already by driver model core */ | 2228 | /* should have been done already by driver model core */ |
@@ -2310,8 +2316,14 @@ net2272_probe_fin(struct net2272 *dev, unsigned int irqflags) | |||
2310 | if (ret) | 2316 | if (ret) |
2311 | goto err_dev_reg; | 2317 | goto err_dev_reg; |
2312 | 2318 | ||
2319 | ret = usb_add_gadget_udc(dev->dev, &dev->gadget); | ||
2320 | if (ret) | ||
2321 | goto err_add_udc; | ||
2322 | |||
2313 | return 0; | 2323 | return 0; |
2314 | 2324 | ||
2325 | err_add_udc: | ||
2326 | device_remove_file(dev->dev, &dev_attr_registers); | ||
2315 | err_dev_reg: | 2327 | err_dev_reg: |
2316 | device_unregister(&dev->gadget.dev); | 2328 | device_unregister(&dev->gadget.dev); |
2317 | err_irq: | 2329 | err_irq: |