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/s3c2410_udc.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/s3c2410_udc.c')
-rw-r--r-- | drivers/usb/gadget/s3c2410_udc.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index 100f2635cf0a..1c19cd3f6a57 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -1552,6 +1552,10 @@ static int s3c2410_vbus_draw(struct usb_gadget *_gadget, unsigned ma) | |||
1552 | return -ENOTSUPP; | 1552 | return -ENOTSUPP; |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | static int s3c2410_udc_start(struct usb_gadget_driver *driver, | ||
1556 | int (*bind)(struct usb_gadget *)); | ||
1557 | static int s3c2410_udc_stop(struct usb_gadget_driver *driver); | ||
1558 | |||
1555 | static const struct usb_gadget_ops s3c2410_ops = { | 1559 | static const struct usb_gadget_ops s3c2410_ops = { |
1556 | .get_frame = s3c2410_udc_get_frame, | 1560 | .get_frame = s3c2410_udc_get_frame, |
1557 | .wakeup = s3c2410_udc_wakeup, | 1561 | .wakeup = s3c2410_udc_wakeup, |
@@ -1559,6 +1563,8 @@ static const struct usb_gadget_ops s3c2410_ops = { | |||
1559 | .pullup = s3c2410_udc_pullup, | 1563 | .pullup = s3c2410_udc_pullup, |
1560 | .vbus_session = s3c2410_udc_vbus_session, | 1564 | .vbus_session = s3c2410_udc_vbus_session, |
1561 | .vbus_draw = s3c2410_vbus_draw, | 1565 | .vbus_draw = s3c2410_vbus_draw, |
1566 | .start = s3c2410_udc_start, | ||
1567 | .stop = s3c2410_udc_stop, | ||
1562 | }; | 1568 | }; |
1563 | 1569 | ||
1564 | static void s3c2410_udc_command(enum s3c2410_udc_cmd_e cmd) | 1570 | static void s3c2410_udc_command(enum s3c2410_udc_cmd_e cmd) |
@@ -1672,10 +1678,7 @@ static void s3c2410_udc_enable(struct s3c2410_udc *dev) | |||
1672 | s3c2410_udc_command(S3C2410_UDC_P_ENABLE); | 1678 | s3c2410_udc_command(S3C2410_UDC_P_ENABLE); |
1673 | } | 1679 | } |
1674 | 1680 | ||
1675 | /* | 1681 | static int s3c2410_udc_start(struct usb_gadget_driver *driver, |
1676 | * usb_gadget_probe_driver | ||
1677 | */ | ||
1678 | int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | ||
1679 | int (*bind)(struct usb_gadget *)) | 1682 | int (*bind)(struct usb_gadget *)) |
1680 | { | 1683 | { |
1681 | struct s3c2410_udc *udc = the_controller; | 1684 | struct s3c2410_udc *udc = the_controller; |
@@ -1730,12 +1733,8 @@ register_error: | |||
1730 | udc->gadget.dev.driver = NULL; | 1733 | udc->gadget.dev.driver = NULL; |
1731 | return retval; | 1734 | return retval; |
1732 | } | 1735 | } |
1733 | EXPORT_SYMBOL(usb_gadget_probe_driver); | ||
1734 | 1736 | ||
1735 | /* | 1737 | static int s3c2410_udc_stop(struct usb_gadget_driver *driver) |
1736 | * usb_gadget_unregister_driver | ||
1737 | */ | ||
1738 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | ||
1739 | { | 1738 | { |
1740 | struct s3c2410_udc *udc = the_controller; | 1739 | struct s3c2410_udc *udc = the_controller; |
1741 | 1740 | ||
@@ -1955,6 +1954,10 @@ static int s3c2410_udc_probe(struct platform_device *pdev) | |||
1955 | goto err_vbus_irq; | 1954 | goto err_vbus_irq; |
1956 | } | 1955 | } |
1957 | 1956 | ||
1957 | retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget); | ||
1958 | if (retval) | ||
1959 | goto err_add_udc; | ||
1960 | |||
1958 | if (s3c2410_udc_debugfs_root) { | 1961 | if (s3c2410_udc_debugfs_root) { |
1959 | udc->regs_info = debugfs_create_file("registers", S_IRUGO, | 1962 | udc->regs_info = debugfs_create_file("registers", S_IRUGO, |
1960 | s3c2410_udc_debugfs_root, | 1963 | s3c2410_udc_debugfs_root, |
@@ -1967,6 +1970,10 @@ static int s3c2410_udc_probe(struct platform_device *pdev) | |||
1967 | 1970 | ||
1968 | return 0; | 1971 | return 0; |
1969 | 1972 | ||
1973 | err_add_udc: | ||
1974 | if (udc_info && !udc_info->udc_command && | ||
1975 | gpio_is_valid(udc_info->pullup_pin)) | ||
1976 | gpio_free(udc_info->pullup_pin); | ||
1970 | err_vbus_irq: | 1977 | err_vbus_irq: |
1971 | if (udc_info && udc_info->vbus_pin > 0) | 1978 | if (udc_info && udc_info->vbus_pin > 0) |
1972 | free_irq(gpio_to_irq(udc_info->vbus_pin), udc); | 1979 | free_irq(gpio_to_irq(udc_info->vbus_pin), udc); |
@@ -1992,6 +1999,8 @@ static int s3c2410_udc_remove(struct platform_device *pdev) | |||
1992 | unsigned int irq; | 1999 | unsigned int irq; |
1993 | 2000 | ||
1994 | dev_dbg(&pdev->dev, "%s()\n", __func__); | 2001 | dev_dbg(&pdev->dev, "%s()\n", __func__); |
2002 | |||
2003 | usb_del_gadget_udc(&udc->gadget); | ||
1995 | if (udc->driver) | 2004 | if (udc->driver) |
1996 | return -EBUSY; | 2005 | return -EBUSY; |
1997 | 2006 | ||
@@ -2105,8 +2114,6 @@ static void __exit udc_exit(void) | |||
2105 | debugfs_remove(s3c2410_udc_debugfs_root); | 2114 | debugfs_remove(s3c2410_udc_debugfs_root); |
2106 | } | 2115 | } |
2107 | 2116 | ||
2108 | EXPORT_SYMBOL(usb_gadget_unregister_driver); | ||
2109 | |||
2110 | module_init(udc_init); | 2117 | module_init(udc_init); |
2111 | module_exit(udc_exit); | 2118 | module_exit(udc_exit); |
2112 | 2119 | ||