aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-11 09:24:26 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-11 09:24:26 -0800
commit5643f000c1e10ab991182478b76550e1364c3570 (patch)
tree950b2f61a5dd742de1c668ba968a9c8a99f1eab6 /drivers/usb/gadget
parent177294d19174cf92de22434bb1fc9a8ecdbbe658 (diff)
parent3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (diff)
Merge master.kernel.org:/home/rmk/linux-2.6-drvmodel
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c76
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c31
-rw-r--r--drivers/usb/gadget/omap_udc.c61
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c41
4 files changed, 106 insertions, 103 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 90451908533..1e407745c11 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -896,7 +896,7 @@ dummy_gadget_release (struct device *dev)
#endif
}
-static int dummy_udc_probe (struct device *dev)
+static int dummy_udc_probe (struct platform_device *dev)
{
struct dummy *dum = the_controller;
int rc;
@@ -909,7 +909,7 @@ static int dummy_udc_probe (struct device *dev)
dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0);
strcpy (dum->gadget.dev.bus_id, "gadget");
- dum->gadget.dev.parent = dev;
+ dum->gadget.dev.parent = &dev->dev;
dum->gadget.dev.release = dummy_gadget_release;
rc = device_register (&dum->gadget.dev);
if (rc < 0)
@@ -919,26 +919,26 @@ static int dummy_udc_probe (struct device *dev)
usb_bus_get (&dummy_to_hcd (dum)->self);
#endif
- dev_set_drvdata (dev, dum);
+ platform_set_drvdata (dev, dum);
device_create_file (&dum->gadget.dev, &dev_attr_function);
return rc;
}
-static int dummy_udc_remove (struct device *dev)
+static int dummy_udc_remove (struct platform_device *dev)
{
- struct dummy *dum = dev_get_drvdata (dev);
+ struct dummy *dum = platform_get_drvdata (dev);
- dev_set_drvdata (dev, NULL);
+ platform_set_drvdata (dev, NULL);
device_remove_file (&dum->gadget.dev, &dev_attr_function);
device_unregister (&dum->gadget.dev);
return 0;
}
-static int dummy_udc_suspend (struct device *dev, pm_message_t state)
+static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state)
{
- struct dummy *dum = dev_get_drvdata(dev);
+ struct dummy *dum = platform_get_drvdata(dev);
- dev_dbg (dev, "%s\n", __FUNCTION__);
+ dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
spin_lock_irq (&dum->lock);
dum->udc_suspended = 1;
set_link_state (dum);
@@ -949,29 +949,30 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state)
return 0;
}
-static int dummy_udc_resume (struct device *dev)
+static int dummy_udc_resume (struct platform_device *dev)
{
- struct dummy *dum = dev_get_drvdata(dev);
+ struct dummy *dum = platform_get_drvdata(dev);
- dev_dbg (dev, "%s\n", __FUNCTION__);
+ dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
spin_lock_irq (&dum->lock);
dum->udc_suspended = 0;
set_link_state (dum);
spin_unlock_irq (&dum->lock);
- dev->power.power_state = PMSG_ON;
+ dev->dev.power.power_state = PMSG_ON;
usb_hcd_poll_rh_status (dummy_to_hcd (dum));
return 0;
}
-static struct device_driver dummy_udc_driver = {
- .name = (char *) gadget_name,
- .owner = THIS_MODULE,
- .bus = &platform_bus_type,
+static struct platform_driver dummy_udc_driver = {
.probe = dummy_udc_probe,
.remove = dummy_udc_remove,
.suspend = dummy_udc_suspend,
.resume = dummy_udc_resume,
+ .driver = {
+ .name = (char *) gadget_name,
+ .owner = THIS_MODULE,
+ },
};
/*-------------------------------------------------------------------------*/
@@ -1898,14 +1899,14 @@ static const struct hc_driver dummy_hcd = {
.bus_resume = dummy_bus_resume,
};
-static int dummy_hcd_probe (struct device *dev)
+static int dummy_hcd_probe (struct platform_device *dev)
{
struct usb_hcd *hcd;
int retval;
dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc);
- hcd = usb_create_hcd (&dummy_hcd, dev, dev->bus_id);
+ hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id);
if (!hcd)
return -ENOMEM;
the_controller = hcd_to_dummy (hcd);
@@ -1918,48 +1919,49 @@ static int dummy_hcd_probe (struct device *dev)
return retval;
}
-static int dummy_hcd_remove (struct device *dev)
+static int dummy_hcd_remove (struct platform_device *dev)
{
struct usb_hcd *hcd;
- hcd = dev_get_drvdata (dev);
+ hcd = platform_get_drvdata (dev);
usb_remove_hcd (hcd);
usb_put_hcd (hcd);
the_controller = NULL;
return 0;
}
-static int dummy_hcd_suspend (struct device *dev, pm_message_t state)
+static int dummy_hcd_suspend (struct platform_device *dev, pm_message_t state)
{
struct usb_hcd *hcd;
- dev_dbg (dev, "%s\n", __FUNCTION__);
- hcd = dev_get_drvdata (dev);
+ dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
+ hcd = platform_get_drvdata (dev);
hcd->state = HC_STATE_SUSPENDED;
return 0;
}
-static int dummy_hcd_resume (struct device *dev)
+static int dummy_hcd_resume (struct platform_device *dev)
{
struct usb_hcd *hcd;
- dev_dbg (dev, "%s\n", __FUNCTION__);
- hcd = dev_get_drvdata (dev);
+ dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
+ hcd = platform_get_drvdata (dev);
hcd->state = HC_STATE_RUNNING;
usb_hcd_poll_rh_status (hcd);
return 0;
}
-static struct device_driver dummy_hcd_driver = {
- .name = (char *) driver_name,
- .owner = THIS_MODULE,
- .bus = &platform_bus_type,
+static struct platform_driver dummy_hcd_driver = {
.probe = dummy_hcd_probe,
.remove = dummy_hcd_remove,
.suspend = dummy_hcd_suspend,
.resume = dummy_hcd_resume,
+ .driver = {
+ .name = (char *) driver_name,
+ .owner = THIS_MODULE,
+ },
};
/*-------------------------------------------------------------------------*/
@@ -1995,11 +1997,11 @@ static int __init init (void)
if (usb_disabled ())
return -ENODEV;
- retval = driver_register (&dummy_hcd_driver);
+ retval = platform_driver_register (&dummy_hcd_driver);
if (retval < 0)
return retval;
- retval = driver_register (&dummy_udc_driver);
+ retval = platform_driver_register (&dummy_udc_driver);
if (retval < 0)
goto err_register_udc_driver;
@@ -2015,9 +2017,9 @@ static int __init init (void)
err_register_udc:
platform_device_unregister (&the_hcd_pdev);
err_register_hcd:
- driver_unregister (&dummy_udc_driver);
+ platform_driver_unregister (&dummy_udc_driver);
err_register_udc_driver:
- driver_unregister (&dummy_hcd_driver);
+ platform_driver_unregister (&dummy_hcd_driver);
return retval;
}
module_init (init);
@@ -2026,7 +2028,7 @@ static void __exit cleanup (void)
{
platform_device_unregister (&the_udc_pdev);
platform_device_unregister (&the_hcd_pdev);
- driver_unregister (&dummy_udc_driver);
- driver_unregister (&dummy_hcd_driver);
+ platform_driver_unregister (&dummy_udc_driver);
+ platform_driver_unregister (&dummy_hcd_driver);
}
module_exit (cleanup);
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index bc6269f10cb..e02fea5a543 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -2085,21 +2085,21 @@ static struct lh7a40x_udc memory = {
/*
* probe - binds to the platform device
*/
-static int lh7a40x_udc_probe(struct device *_dev)
+static int lh7a40x_udc_probe(struct platform_device *pdev)
{
struct lh7a40x_udc *dev = &memory;
int retval;
- DEBUG("%s: %p\n", __FUNCTION__, _dev);
+ DEBUG("%s: %p\n", __FUNCTION__, pdev);
spin_lock_init(&dev->lock);
- dev->dev = _dev;
+ dev->dev = &pdev->dev;
device_initialize(&dev->gadget.dev);
- dev->gadget.dev.parent = _dev;
+ dev->gadget.dev.parent = &pdev->dev;
the_controller = dev;
- dev_set_drvdata(_dev, dev);
+ platform_set_drvdata(pdev, dev);
udc_disable(dev);
udc_reinit(dev);
@@ -2119,11 +2119,11 @@ static int lh7a40x_udc_probe(struct device *_dev)
return retval;
}
-static int lh7a40x_udc_remove(struct device *_dev)
+static int lh7a40x_udc_remove(struct platform_device *pdev)
{
- struct lh7a40x_udc *dev = _dev->driver_data;
+ struct lh7a40x_udc *dev = platform_get_drvdata(pdev);
- DEBUG("%s: %p\n", __FUNCTION__, dev);
+ DEBUG("%s: %p\n", __FUNCTION__, pdev);
udc_disable(dev);
remove_proc_files();
@@ -2131,7 +2131,7 @@ static int lh7a40x_udc_remove(struct device *_dev)
free_irq(IRQ_USBINTR, dev);
- dev_set_drvdata(_dev, 0);
+ platform_set_drvdata(pdev, 0);
the_controller = 0;
@@ -2140,26 +2140,27 @@ static int lh7a40x_udc_remove(struct device *_dev)
/*-------------------------------------------------------------------------*/
-static struct device_driver udc_driver = {
- .name = (char *)driver_name,
- .owner = THIS_MODULE,
- .bus = &platform_bus_type,
+static struct platform_driver udc_driver = {
.probe = lh7a40x_udc_probe,
.remove = lh7a40x_udc_remove
/* FIXME power management support */
/* .suspend = ... disable UDC */
/* .resume = ... re-enable UDC */
+ .driver = {
+ .name = (char *)driver_name,
+ .owner = THIS_MODULE,
+ },
};
static int __init udc_init(void)
{
DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION);
- return driver_register(&udc_driver);
+ return platform_driver_register(&udc_driver);
}
static void __exit udc_exit(void)
{
- driver_unregister(&udc_driver);
+ platform_driver_unregister(&udc_driver);
}
module_init(udc_init);
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 387692a3611..a8972d7c97b 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2707,18 +2707,17 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)
return 0;
}
-static int __init omap_udc_probe(struct device *dev)
+static int __init omap_udc_probe(struct platform_device *pdev)
{
- struct platform_device *odev = to_platform_device(dev);
int status = -ENODEV;
int hmc;
struct otg_transceiver *xceiv = NULL;
const char *type = NULL;
- struct omap_usb_config *config = dev->platform_data;
+ struct omap_usb_config *config = pdev->dev.platform_data;
/* NOTE: "knows" the order of the resources! */
- if (!request_mem_region(odev->resource[0].start,
- odev->resource[0].end - odev->resource[0].start + 1,
+ if (!request_mem_region(pdev->resource[0].start,
+ pdev->resource[0].end - pdev->resource[0].start + 1,
driver_name)) {
DBG("request_mem_region failed\n");
return -EBUSY;
@@ -2803,7 +2802,7 @@ bad_on_1710:
INFO("hmc mode %d, %s transceiver\n", hmc, type);
/* a "gadget" abstracts/virtualizes the controller */
- status = omap_udc_setup(odev, xceiv);
+ status = omap_udc_setup(pdev, xceiv);
if (status) {
goto cleanup0;
}
@@ -2821,28 +2820,28 @@ bad_on_1710:
udc->clr_halt = UDC_RESET_EP;
/* USB general purpose IRQ: ep0, state changes, dma, etc */
- status = request_irq(odev->resource[1].start, omap_udc_irq,
+ status = request_irq(pdev->resource[1].start, omap_udc_irq,
SA_SAMPLE_RANDOM, driver_name, udc);
if (status != 0) {
ERR( "can't get irq %ld, err %d\n",
- odev->resource[1].start, status);
+ pdev->resource[1].start, status);
goto cleanup1;
}
/* USB "non-iso" IRQ (PIO for all but ep0) */
- status = request_irq(odev->resource[2].start, omap_udc_pio_irq,
+ status = request_irq(pdev->resource[2].start, omap_udc_pio_irq,
SA_SAMPLE_RANDOM, "omap_udc pio", udc);
if (status != 0) {
ERR( "can't get irq %ld, err %d\n",
- odev->resource[2].start, status);
+ pdev->resource[2].start, status);
goto cleanup2;
}
#ifdef USE_ISO
- status = request_irq(odev->resource[3].start, omap_udc_iso_irq,
+ status = request_irq(pdev->resource[3].start, omap_udc_iso_irq,
SA_INTERRUPT, "omap_udc iso", udc);
if (status != 0) {
ERR("can't get irq %ld, err %d\n",
- odev->resource[3].start, status);
+ pdev->resource[3].start, status);
goto cleanup3;
}
#endif
@@ -2853,11 +2852,11 @@ bad_on_1710:
#ifdef USE_ISO
cleanup3:
- free_irq(odev->resource[2].start, udc);
+ free_irq(pdev->resource[2].start, udc);
#endif
cleanup2:
- free_irq(odev->resource[1].start, udc);
+ free_irq(pdev->resource[1].start, udc);
cleanup1:
kfree (udc);
@@ -2866,14 +2865,13 @@ cleanup1:
cleanup0:
if (xceiv)
put_device(xceiv->dev);
- release_mem_region(odev->resource[0].start,
- odev->resource[0].end - odev->resource[0].start + 1);
+ release_mem_region(pdev->resource[0].start,
+ pdev->resource[0].end - pdev->resource[0].start + 1);
return status;
}
-static int __exit omap_udc_remove(struct device *dev)
+static int __exit omap_udc_remove(struct platform_device *pdev)
{
- struct platform_device *odev = to_platform_device(dev);
DECLARE_COMPLETION(done);
if (!udc)
@@ -2891,13 +2889,13 @@ static int __exit omap_udc_remove(struct device *dev)
remove_proc_file();
#ifdef USE_ISO
- free_irq(odev->resource[3].start, udc);
+ free_irq(pdev->resource[3].start, udc);
#endif
- free_irq(odev->resource[2].start, udc);
- free_irq(odev->resource[1].start, udc);
+ free_irq(pdev->resource[2].start, udc);
+ free_irq(pdev->resource[1].start, udc);
- release_mem_region(odev->resource[0].start,
- odev->resource[0].end - odev->resource[0].start + 1);
+ release_mem_region(pdev->resource[0].start,
+ pdev->resource[0].end - pdev->resource[0].start + 1);
device_unregister(&udc->gadget.dev);
wait_for_completion(&done);
@@ -2915,7 +2913,7 @@ static int __exit omap_udc_remove(struct device *dev)
* may involve talking to an external transceiver (e.g. isp1301).
*/
-static int omap_udc_suspend(struct device *dev, pm_message_t message)
+static int omap_udc_suspend(struct platform_device *dev, pm_message_t message)
{
u32 devstat;
@@ -2935,7 +2933,7 @@ static int omap_udc_suspend(struct device *dev, pm_message_t message)
return 0;
}
-static int omap_udc_resume(struct device *dev)
+static int omap_udc_resume(struct platform_device *dev)
{
DBG("resume + wakeup/SRP\n");
omap_pullup(&udc->gadget, 1);
@@ -2947,14 +2945,15 @@ static int omap_udc_resume(struct device *dev)
/*-------------------------------------------------------------------------*/
-static struct device_driver udc_driver = {
- .name = (char *) driver_name,
- .owner = THIS_MODULE,
- .bus = &platform_bus_type,
+static struct platform_driver udc_driver = {
.probe = omap_udc_probe,
.remove = __exit_p(omap_udc_remove),
.suspend = omap_udc_suspend,
.resume = omap_udc_resume,
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = (char *) driver_name,
+ },
};
static int __init udc_init(void)
@@ -2965,13 +2964,13 @@ static int __init udc_init(void)
#endif
"%s\n", driver_desc,
use_dma ? " (dma)" : "");
- return driver_register(&udc_driver);
+ return platform_driver_register(&udc_driver);
}
module_init(udc_init);
static void __exit udc_exit(void)
{
- driver_unregister(&udc_driver);
+ platform_driver_unregister(&udc_driver);
}
module_exit(udc_exit);
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 510d28a924d..bb028c5b895 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -2432,7 +2432,7 @@ static struct pxa2xx_udc memory = {
/*
* probe - binds to the platform device
*/
-static int __init pxa2xx_udc_probe(struct device *_dev)
+static int __init pxa2xx_udc_probe(struct platform_device *pdev)
{
struct pxa2xx_udc *dev = &memory;
int retval, out_dma = 1;
@@ -2495,19 +2495,19 @@ static int __init pxa2xx_udc_probe(struct device *_dev)
#endif
/* other non-static parts of init */
- dev->dev = _dev;
- dev->mach = _dev->platform_data;
+ dev->dev = &pdev->dev;
+ dev->mach = pdev->dev.platform_data;
init_timer(&dev->timer);
dev->timer.function = udc_watchdog;
dev->timer.data = (unsigned long) dev;
device_initialize(&dev->gadget.dev);
- dev->gadget.dev.parent = _dev;
- dev->gadget.dev.dma_mask = _dev->dma_mask;
+ dev->gadget.dev.parent = &pdev->dev;
+ dev->gadget.dev.dma_mask = pdev->dev.dma_mask;
the_controller = dev;
- dev_set_drvdata(_dev, dev);
+ platform_set_drvdata(pdev, dev);
udc_disable(dev);
udc_reinit(dev);
@@ -2559,14 +2559,14 @@ lubbock_fail0:
return 0;
}
-static void pxa2xx_udc_shutdown(struct device *_dev)
+static void pxa2xx_udc_shutdown(struct platform_device *_dev)
{
pullup_off();
}
-static int __exit pxa2xx_udc_remove(struct device *_dev)
+static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
{
- struct pxa2xx_udc *dev = dev_get_drvdata(_dev);
+ struct pxa2xx_udc *dev = platform_get_drvdata(pdev);
udc_disable(dev);
remove_proc_files();
@@ -2580,7 +2580,7 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
free_irq(LUBBOCK_USB_DISC_IRQ, dev);
free_irq(LUBBOCK_USB_IRQ, dev);
}
- dev_set_drvdata(_dev, NULL);
+ platform_set_drvdata(pdev, NULL);
the_controller = NULL;
return 0;
}
@@ -2601,9 +2601,9 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
* VBUS IRQs should probably be ignored so that the PXA device just acts
* "dead" to USB hosts until system resume.
*/
-static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state)
+static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
{
- struct pxa2xx_udc *udc = dev_get_drvdata(dev);
+ struct pxa2xx_udc *udc = platform_get_drvdata(dev);
if (!udc->mach->udc_command)
WARN("USB host won't detect disconnect!\n");
@@ -2612,9 +2612,9 @@ static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state)
return 0;
}
-static int pxa2xx_udc_resume(struct device *dev)
+static int pxa2xx_udc_resume(struct platform_device *dev)
{
- struct pxa2xx_udc *udc = dev_get_drvdata(dev);
+ struct pxa2xx_udc *udc = platform_get_drvdata(dev);
pullup(udc, 1);
@@ -2628,27 +2628,28 @@ static int pxa2xx_udc_resume(struct device *dev)
/*-------------------------------------------------------------------------*/
-static struct device_driver udc_driver = {
- .name = "pxa2xx-udc",
- .owner = THIS_MODULE,
- .bus = &platform_bus_type,
+static struct platform_driver udc_driver = {
.probe = pxa2xx_udc_probe,
.shutdown = pxa2xx_udc_shutdown,
.remove = __exit_p(pxa2xx_udc_remove),
.suspend = pxa2xx_udc_suspend,
.resume = pxa2xx_udc_resume,
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "pxa2xx-udc",
+ },
};
static int __init udc_init(void)
{
printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION);
- return driver_register(&udc_driver);
+ return platform_driver_register(&udc_driver);
}
module_init(udc_init);
static void __exit udc_exit(void)
{
- driver_unregister(&udc_driver);
+ platform_driver_unregister(&udc_driver);
}
module_exit(udc_exit);