summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/dummy_hcd.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-06-23 14:26:17 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-01 14:31:14 -0700
commitaa0747394337e50533badd46e8fb7106bad3311e (patch)
tree856b353fe931c4acea2115d5c7510ca3cde683eb /drivers/usb/gadget/dummy_hcd.c
parente71eb392c2014e2b377810ad329e36b0229d041c (diff)
downloadop-kernel-dev-aa0747394337e50533badd46e8fb7106bad3311e.zip
op-kernel-dev-aa0747394337e50533badd46e8fb7106bad3311e.tar.gz
usb: gadget: dummy_hcd: convert to new-style udc-probe
bind() and pull is moved to udc core, call callbacks are verified by the upper layer. 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/dummy_hcd.c')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c50
1 files changed, 15 insertions, 35 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index f5c0d8f..e755a9d 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -857,17 +857,18 @@ static int dummy_pullup (struct usb_gadget *_gadget, int value)
return 0;
}
-static int dummy_udc_start(struct usb_gadget_driver *driver,
- int (*bind)(struct usb_gadget *));
-static int dummy_udc_stop(struct usb_gadget_driver *driver);
+static int dummy_udc_start(struct usb_gadget *g,
+ struct usb_gadget_driver *driver);
+static int dummy_udc_stop(struct usb_gadget *g,
+ struct usb_gadget_driver *driver);
static const struct usb_gadget_ops dummy_ops = {
.get_frame = dummy_g_get_frame,
.wakeup = dummy_wakeup,
.set_selfpowered = dummy_set_selfpowered,
.pullup = dummy_pullup,
- .start = dummy_udc_start,
- .stop = dummy_udc_stop,
+ .udc_start = dummy_udc_start,
+ .udc_stop = dummy_udc_stop,
};
/*-------------------------------------------------------------------------*/
@@ -900,17 +901,13 @@ static DEVICE_ATTR (function, S_IRUGO, show_function, NULL);
* for each driver that registers: just add to a big root hub.
*/
-static int dummy_udc_start(struct usb_gadget_driver *driver,
- int (*bind)(struct usb_gadget *))
+static int dummy_udc_start(struct usb_gadget *g,
+ struct usb_gadget_driver *driver)
{
- struct dummy *dum = &the_controller;
- int retval;
+ struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g);
+ struct dummy *dum = dum_hcd->dum;
- if (!dum)
- return -EINVAL;
- if (dum->driver)
- return -EBUSY;
- if (!bind || !driver->setup || driver->speed == USB_SPEED_UNKNOWN)
+ if (driver->speed == USB_SPEED_UNKNOWN)
return -EINVAL;
/*
@@ -921,37 +918,20 @@ static int dummy_udc_start(struct usb_gadget_driver *driver,
dum->devstatus = 0;
dum->driver = driver;
- dum->gadget.dev.driver = &driver->driver;
dev_dbg (udc_dev(dum), "binding gadget driver '%s'\n",
driver->driver.name);
- retval = bind(&dum->gadget);
- if (retval) {
- dum->driver = NULL;
- dum->gadget.dev.driver = NULL;
- return retval;
- }
-
- /* khubd will enumerate this in a while */
- dummy_pullup(&dum->gadget, 1);
return 0;
}
-static int dummy_udc_stop(struct usb_gadget_driver *driver)
+static int dummy_udc_stop(struct usb_gadget *g,
+ struct usb_gadget_driver *driver)
{
- struct dummy *dum = &the_controller;
-
- if (!dum)
- return -ENODEV;
- if (!driver || driver != dum->driver || !driver->unbind)
- return -EINVAL;
+ struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g);
+ struct dummy *dum = dum_hcd->dum;
dev_dbg (udc_dev(dum), "unregister gadget driver '%s'\n",
driver->driver.name);
- dummy_pullup(&dum->gadget, 0);
-
- driver->unbind (&dum->gadget);
- dum->gadget.dev.driver = NULL;
dum->driver = NULL;
dummy_pullup(&dum->gadget, 0);
OpenPOWER on IntegriCloud