dt/usb: Eliminate users of of_platform_{,un}register_driver

Get rid of users of of_platform_driver in drivers/usb.  The
of_platform_{,un}register_driver functions are going away, so the
users need to be converted to using the platform_bus_type directly.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
Grant Likely 2011-02-22 21:08:34 -07:00
parent 28541d0f18
commit d35fb64176
8 changed files with 33 additions and 41 deletions

View File

@ -2523,8 +2523,7 @@ static void qe_udc_release(struct device *dev)
} }
/* Driver probe functions */ /* Driver probe functions */
static int __devinit qe_udc_probe(struct platform_device *ofdev, static int __devinit qe_udc_probe(struct platform_device *ofdev)
const struct of_device_id *match)
{ {
struct device_node *np = ofdev->dev.of_node; struct device_node *np = ofdev->dev.of_node;
struct qe_ep *ep; struct qe_ep *ep;
@ -2532,6 +2531,9 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev,
unsigned int i; unsigned int i;
const void *prop; const void *prop;
if (!ofdev->dev.of_match)
return -EINVAL;
prop = of_get_property(np, "mode", NULL); prop = of_get_property(np, "mode", NULL);
if (!prop || strcmp(prop, "peripheral")) if (!prop || strcmp(prop, "peripheral"))
return -ENODEV; return -ENODEV;
@ -2543,7 +2545,7 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev,
return -ENOMEM; return -ENOMEM;
} }
udc_controller->soc_type = (unsigned long)match->data; udc_controller->soc_type = (unsigned long)ofdev->dev.of_match->data;
udc_controller->usb_regs = of_iomap(np, 0); udc_controller->usb_regs = of_iomap(np, 0);
if (!udc_controller->usb_regs) { if (!udc_controller->usb_regs) {
ret = -ENOMEM; ret = -ENOMEM;
@ -2768,7 +2770,7 @@ static const struct of_device_id qe_udc_match[] __devinitconst = {
MODULE_DEVICE_TABLE(of, qe_udc_match); MODULE_DEVICE_TABLE(of, qe_udc_match);
static struct of_platform_driver udc_driver = { static struct platform_driver udc_driver = {
.driver = { .driver = {
.name = (char *)driver_name, .name = (char *)driver_name,
.owner = THIS_MODULE, .owner = THIS_MODULE,
@ -2786,12 +2788,12 @@ static int __init qe_udc_init(void)
{ {
printk(KERN_INFO "%s: %s, %s\n", driver_name, driver_desc, printk(KERN_INFO "%s: %s, %s\n", driver_name, driver_desc,
DRIVER_VERSION); DRIVER_VERSION);
return of_register_platform_driver(&udc_driver); return platform_driver_register(&udc_driver);
} }
static void __exit qe_udc_exit(void) static void __exit qe_udc_exit(void)
{ {
of_unregister_platform_driver(&udc_driver); platform_driver_unregister(&udc_driver);
} }
module_init(qe_udc_init); module_init(qe_udc_init);

View File

@ -1306,24 +1306,24 @@ static int __init ehci_hcd_init(void)
#endif #endif
#ifdef OF_PLATFORM_DRIVER #ifdef OF_PLATFORM_DRIVER
retval = of_register_platform_driver(&OF_PLATFORM_DRIVER); retval = platform_driver_register(&OF_PLATFORM_DRIVER);
if (retval < 0) if (retval < 0)
goto clean3; goto clean3;
#endif #endif
#ifdef XILINX_OF_PLATFORM_DRIVER #ifdef XILINX_OF_PLATFORM_DRIVER
retval = of_register_platform_driver(&XILINX_OF_PLATFORM_DRIVER); retval = platform_driver_register(&XILINX_OF_PLATFORM_DRIVER);
if (retval < 0) if (retval < 0)
goto clean4; goto clean4;
#endif #endif
return retval; return retval;
#ifdef XILINX_OF_PLATFORM_DRIVER #ifdef XILINX_OF_PLATFORM_DRIVER
/* of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); */ /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */
clean4: clean4:
#endif #endif
#ifdef OF_PLATFORM_DRIVER #ifdef OF_PLATFORM_DRIVER
of_unregister_platform_driver(&OF_PLATFORM_DRIVER); platform_driver_unregister(&OF_PLATFORM_DRIVER);
clean3: clean3:
#endif #endif
#ifdef PS3_SYSTEM_BUS_DRIVER #ifdef PS3_SYSTEM_BUS_DRIVER
@ -1351,10 +1351,10 @@ module_init(ehci_hcd_init);
static void __exit ehci_hcd_cleanup(void) static void __exit ehci_hcd_cleanup(void)
{ {
#ifdef XILINX_OF_PLATFORM_DRIVER #ifdef XILINX_OF_PLATFORM_DRIVER
of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER);
#endif #endif
#ifdef OF_PLATFORM_DRIVER #ifdef OF_PLATFORM_DRIVER
of_unregister_platform_driver(&OF_PLATFORM_DRIVER); platform_driver_unregister(&OF_PLATFORM_DRIVER);
#endif #endif
#ifdef PLATFORM_DRIVER #ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER); platform_driver_unregister(&PLATFORM_DRIVER);

View File

@ -105,8 +105,7 @@ ppc44x_enable_bmt(struct device_node *dn)
} }
static int __devinit static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op)
ehci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match)
{ {
struct device_node *dn = op->dev.of_node; struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd; struct usb_hcd *hcd;
@ -255,14 +254,12 @@ static int ehci_hcd_ppc_of_remove(struct platform_device *op)
} }
static int ehci_hcd_ppc_of_shutdown(struct platform_device *op) static void ehci_hcd_ppc_of_shutdown(struct platform_device *op)
{ {
struct usb_hcd *hcd = dev_get_drvdata(&op->dev); struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
if (hcd->driver->shutdown) if (hcd->driver->shutdown)
hcd->driver->shutdown(hcd); hcd->driver->shutdown(hcd);
return 0;
} }
@ -275,7 +272,7 @@ static const struct of_device_id ehci_hcd_ppc_of_match[] = {
MODULE_DEVICE_TABLE(of, ehci_hcd_ppc_of_match); MODULE_DEVICE_TABLE(of, ehci_hcd_ppc_of_match);
static struct of_platform_driver ehci_hcd_ppc_of_driver = { static struct platform_driver ehci_hcd_ppc_of_driver = {
.probe = ehci_hcd_ppc_of_probe, .probe = ehci_hcd_ppc_of_probe,
.remove = ehci_hcd_ppc_of_remove, .remove = ehci_hcd_ppc_of_remove,
.shutdown = ehci_hcd_ppc_of_shutdown, .shutdown = ehci_hcd_ppc_of_shutdown,

View File

@ -142,15 +142,13 @@ static const struct hc_driver ehci_xilinx_of_hc_driver = {
/** /**
* ehci_hcd_xilinx_of_probe - Probe method for the USB host controller * ehci_hcd_xilinx_of_probe - Probe method for the USB host controller
* @op: pointer to the platform_device bound to the host controller * @op: pointer to the platform_device bound to the host controller
* @match: pointer to of_device_id structure, not used
* *
* This function requests resources and sets up appropriate properties for the * This function requests resources and sets up appropriate properties for the
* host controller. Because the Xilinx USB host controller can be configured * host controller. Because the Xilinx USB host controller can be configured
* as HS only or HS/FS only, it checks the configuration in the device tree * as HS only or HS/FS only, it checks the configuration in the device tree
* entry, and sets an appropriate value for hcd->has_tt. * entry, and sets an appropriate value for hcd->has_tt.
*/ */
static int __devinit static int __devinit ehci_hcd_xilinx_of_probe(struct platform_device *op)
ehci_hcd_xilinx_of_probe(struct platform_device *op, const struct of_device_id *match)
{ {
struct device_node *dn = op->dev.of_node; struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd; struct usb_hcd *hcd;
@ -288,7 +286,7 @@ static const struct of_device_id ehci_hcd_xilinx_of_match[] = {
}; };
MODULE_DEVICE_TABLE(of, ehci_hcd_xilinx_of_match); MODULE_DEVICE_TABLE(of, ehci_hcd_xilinx_of_match);
static struct of_platform_driver ehci_hcd_xilinx_of_driver = { static struct platform_driver ehci_hcd_xilinx_of_driver = {
.probe = ehci_hcd_xilinx_of_probe, .probe = ehci_hcd_xilinx_of_probe,
.remove = ehci_hcd_xilinx_of_remove, .remove = ehci_hcd_xilinx_of_remove,
.shutdown = ehci_hcd_xilinx_of_shutdown, .shutdown = ehci_hcd_xilinx_of_shutdown,

View File

@ -561,8 +561,7 @@ static const struct hc_driver fhci_driver = {
.hub_control = fhci_hub_control, .hub_control = fhci_hub_control,
}; };
static int __devinit of_fhci_probe(struct platform_device *ofdev, static int __devinit of_fhci_probe(struct platform_device *ofdev)
const struct of_device_id *ofid)
{ {
struct device *dev = &ofdev->dev; struct device *dev = &ofdev->dev;
struct device_node *node = dev->of_node; struct device_node *node = dev->of_node;
@ -812,7 +811,7 @@ static const struct of_device_id of_fhci_match[] = {
}; };
MODULE_DEVICE_TABLE(of, of_fhci_match); MODULE_DEVICE_TABLE(of, of_fhci_match);
static struct of_platform_driver of_fhci_driver = { static struct platform_driver of_fhci_driver = {
.driver = { .driver = {
.name = "fsl,usb-fhci", .name = "fsl,usb-fhci",
.owner = THIS_MODULE, .owner = THIS_MODULE,
@ -824,13 +823,13 @@ static struct of_platform_driver of_fhci_driver = {
static int __init fhci_module_init(void) static int __init fhci_module_init(void)
{ {
return of_register_platform_driver(&of_fhci_driver); return platform_driver_register(&of_fhci_driver);
} }
module_init(fhci_module_init); module_init(fhci_module_init);
static void __exit fhci_module_exit(void) static void __exit fhci_module_exit(void)
{ {
of_unregister_platform_driver(&of_fhci_driver); platform_driver_unregister(&of_fhci_driver);
} }
module_exit(fhci_module_exit); module_exit(fhci_module_exit);

View File

@ -27,8 +27,7 @@
#endif #endif
#ifdef CONFIG_PPC_OF #ifdef CONFIG_PPC_OF
static int of_isp1760_probe(struct platform_device *dev, static int of_isp1760_probe(struct platform_device *dev)
const struct of_device_id *match)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
struct device_node *dp = dev->dev.of_node; struct device_node *dp = dev->dev.of_node;
@ -119,7 +118,7 @@ static const struct of_device_id of_isp1760_match[] = {
}; };
MODULE_DEVICE_TABLE(of, of_isp1760_match); MODULE_DEVICE_TABLE(of, of_isp1760_match);
static struct of_platform_driver isp1760_of_driver = { static struct platform_driver isp1760_of_driver = {
.driver = { .driver = {
.name = "nxp-isp1760", .name = "nxp-isp1760",
.owner = THIS_MODULE, .owner = THIS_MODULE,
@ -398,7 +397,7 @@ static int __init isp1760_init(void)
if (!ret) if (!ret)
any_ret = 0; any_ret = 0;
#ifdef CONFIG_PPC_OF #ifdef CONFIG_PPC_OF
ret = of_register_platform_driver(&isp1760_of_driver); ret = platform_driver_register(&isp1760_of_driver);
if (!ret) if (!ret)
any_ret = 0; any_ret = 0;
#endif #endif
@ -418,7 +417,7 @@ static void __exit isp1760_exit(void)
{ {
platform_driver_unregister(&isp1760_plat_driver); platform_driver_unregister(&isp1760_plat_driver);
#ifdef CONFIG_PPC_OF #ifdef CONFIG_PPC_OF
of_unregister_platform_driver(&isp1760_of_driver); platform_driver_unregister(&isp1760_of_driver);
#endif #endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
pci_unregister_driver(&isp1761_pci_driver); pci_unregister_driver(&isp1761_pci_driver);

View File

@ -1180,7 +1180,7 @@ static int __init ohci_hcd_mod_init(void)
#endif #endif
#ifdef OF_PLATFORM_DRIVER #ifdef OF_PLATFORM_DRIVER
retval = of_register_platform_driver(&OF_PLATFORM_DRIVER); retval = platform_driver_register(&OF_PLATFORM_DRIVER);
if (retval < 0) if (retval < 0)
goto error_of_platform; goto error_of_platform;
#endif #endif
@ -1239,7 +1239,7 @@ static int __init ohci_hcd_mod_init(void)
error_sa1111: error_sa1111:
#endif #endif
#ifdef OF_PLATFORM_DRIVER #ifdef OF_PLATFORM_DRIVER
of_unregister_platform_driver(&OF_PLATFORM_DRIVER); platform_driver_unregister(&OF_PLATFORM_DRIVER);
error_of_platform: error_of_platform:
#endif #endif
#ifdef PLATFORM_DRIVER #ifdef PLATFORM_DRIVER
@ -1287,7 +1287,7 @@ static void __exit ohci_hcd_mod_exit(void)
sa1111_driver_unregister(&SA1111_DRIVER); sa1111_driver_unregister(&SA1111_DRIVER);
#endif #endif
#ifdef OF_PLATFORM_DRIVER #ifdef OF_PLATFORM_DRIVER
of_unregister_platform_driver(&OF_PLATFORM_DRIVER); platform_driver_unregister(&OF_PLATFORM_DRIVER);
#endif #endif
#ifdef PLATFORM_DRIVER #ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER); platform_driver_unregister(&PLATFORM_DRIVER);

View File

@ -80,8 +80,7 @@ static const struct hc_driver ohci_ppc_of_hc_driver = {
}; };
static int __devinit static int __devinit ohci_hcd_ppc_of_probe(struct platform_device *op)
ohci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match)
{ {
struct device_node *dn = op->dev.of_node; struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd; struct usb_hcd *hcd;
@ -201,14 +200,12 @@ static int ohci_hcd_ppc_of_remove(struct platform_device *op)
return 0; return 0;
} }
static int ohci_hcd_ppc_of_shutdown(struct platform_device *op) static void ohci_hcd_ppc_of_shutdown(struct platform_device *op)
{ {
struct usb_hcd *hcd = dev_get_drvdata(&op->dev); struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
if (hcd->driver->shutdown) if (hcd->driver->shutdown)
hcd->driver->shutdown(hcd); hcd->driver->shutdown(hcd);
return 0;
} }
@ -243,7 +240,7 @@ MODULE_DEVICE_TABLE(of, ohci_hcd_ppc_of_match);
#endif #endif
static struct of_platform_driver ohci_hcd_ppc_of_driver = { static struct platform_driver ohci_hcd_ppc_of_driver = {
.probe = ohci_hcd_ppc_of_probe, .probe = ohci_hcd_ppc_of_probe,
.remove = ohci_hcd_ppc_of_remove, .remove = ohci_hcd_ppc_of_remove,
.shutdown = ohci_hcd_ppc_of_shutdown, .shutdown = ohci_hcd_ppc_of_shutdown,