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>
Este commit está contenido en:
Sebastian Andrzej Siewior
2011-06-28 16:33:47 +03:00
cometido por Greg Kroah-Hartman
padre 2ccea03a8f
commit 0f91349b89
Se han modificado 26 ficheros con 388 adiciones y 143 borrados

Ver fichero

@@ -1704,6 +1704,10 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on)
return 0;
}
static int musb_gadget_start(struct usb_gadget_driver *driver,
int (*bind)(struct usb_gadget *));
static int musb_gadget_stop(struct usb_gadget_driver *driver);
static const struct usb_gadget_ops musb_gadget_operations = {
.get_frame = musb_gadget_get_frame,
.wakeup = musb_gadget_wakeup,
@@ -1711,6 +1715,8 @@ static const struct usb_gadget_ops musb_gadget_operations = {
/* .vbus_session = musb_gadget_vbus_session, */
.vbus_draw = musb_gadget_vbus_draw,
.pullup = musb_gadget_pullup,
.start = musb_gadget_start,
.stop = musb_gadget_stop,
};
/* ----------------------------------------------------------------------- */
@@ -1835,7 +1841,16 @@ int __init musb_gadget_setup(struct musb *musb)
if (status != 0) {
put_device(&musb->g.dev);
the_gadget = NULL;
return status;
}
status = usb_add_gadget_udc(musb->controller, &musb->g);
if (status)
goto err;
return 0;
err:
device_unregister(&musb->g.dev);
the_gadget = NULL;
return status;
}
@@ -1844,6 +1859,7 @@ void musb_gadget_cleanup(struct musb *musb)
if (musb != the_gadget)
return;
usb_del_gadget_udc(&musb->g);
device_unregister(&musb->g.dev);
the_gadget = NULL;
}
@@ -1860,7 +1876,7 @@ void musb_gadget_cleanup(struct musb *musb)
* @param bind the driver's bind function
* @return <0 if error, 0 if everything is fine
*/
int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
static int musb_gadget_start(struct usb_gadget_driver *driver,
int (*bind)(struct usb_gadget *))
{
struct musb *musb = the_gadget;
@@ -1962,7 +1978,6 @@ err1:
err0:
return retval;
}
EXPORT_SYMBOL(usb_gadget_probe_driver);
static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver)
{
@@ -2012,7 +2027,7 @@ static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver)
*
* @param driver the gadget driver to unregister
*/
int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
static int musb_gadget_stop(struct usb_gadget_driver *driver)
{
struct musb *musb = the_gadget;
unsigned long flags;
@@ -2071,8 +2086,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
return 0;
}
EXPORT_SYMBOL(usb_gadget_unregister_driver);
/* ----------------------------------------------------------------------- */