From 0f91349b89f37dfad7b77f7829a105b6a0f526ec Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 28 Jun 2011 16:33:47 +0300 Subject: 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 Cc: Anton Tikhomirov Cc: Ben Dooks Cc: Dan Carpenter Cc: Darius Augulis Cc: Eric Miao Cc: Jingoo Han Cc: Kukjin Kim Cc: Kuninori Morimoto Cc: Li Yang Cc: Michael Hennerich Acked-by: Mike Frysinger Cc: Nicolas Ferre Cc: Pavankumar Kondeti Cc: Roy Huang Cc: Russell King Cc: Toshiharu Okada Cc: Xiaochen Shen Cc: Yoshihiro Shimoda Cc: Yuan-Hsin Chen Cc: cxie4 Cc: linux-geode@lists.infradead.org Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/goku_udc.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'drivers/usb/gadget/goku_udc.c') diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index bf6e11c758d5..7f87805cddc4 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c @@ -996,8 +996,14 @@ static int goku_get_frame(struct usb_gadget *_gadget) return -EOPNOTSUPP; } +static int goku_start(struct usb_gadget_driver *driver, + int (*bind)(struct usb_gadget *)); +static int goku_stop(struct usb_gadget_driver *driver); + static const struct usb_gadget_ops goku_ops = { .get_frame = goku_get_frame, + .start = goku_start, + .stop = goku_stop, // no remote wakeup // not selfpowered }; @@ -1344,7 +1350,7 @@ static struct goku_udc *the_controller; * disconnect is reported. then a host may connect again, or * the driver might get unbound. */ -int usb_gadget_probe_driver(struct usb_gadget_driver *driver, +static int goku_start(struct usb_gadget_driver *driver, int (*bind)(struct usb_gadget *)) { struct goku_udc *dev = the_controller; @@ -1382,7 +1388,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, DBG(dev, "registered gadget driver '%s'\n", driver->driver.name); return 0; } -EXPORT_SYMBOL(usb_gadget_probe_driver); static void stop_activity(struct goku_udc *dev, struct usb_gadget_driver *driver) @@ -1408,7 +1413,7 @@ stop_activity(struct goku_udc *dev, struct usb_gadget_driver *driver) udc_enable(dev); } -int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) +static int goku_stop(struct usb_gadget_driver *driver) { struct goku_udc *dev = the_controller; unsigned long flags; @@ -1429,8 +1434,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) DBG(dev, "unregistered driver '%s'\n", driver->driver.name); return 0; } -EXPORT_SYMBOL(usb_gadget_unregister_driver); - /*-------------------------------------------------------------------------*/ @@ -1730,6 +1733,8 @@ static void goku_remove(struct pci_dev *pdev) DBG(dev, "%s\n", __func__); + usb_del_gadget_udc(&dev->gadget); + BUG_ON(dev->driver); #ifdef CONFIG_USB_GADGET_DEBUG_FILES @@ -1854,6 +1859,10 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err; } dev->registered = 1; + retval = usb_add_gadget_udc(&pdev->dev, &dev->gadget); + if (retval) + goto err; + return 0; err: -- cgit v1.2.3