Skip to content

Commit

Permalink
dt/usb: Eliminate users of of_platform_{,un}register_driver
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Grant Likely committed Feb 28, 2011
1 parent 28541d0 commit d35fb64
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 41 deletions.
14 changes: 8 additions & 6 deletions drivers/usb/gadget/fsl_qe_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2523,15 +2523,17 @@ static void qe_udc_release(struct device *dev)
}

/* Driver probe functions */
static int __devinit qe_udc_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int __devinit qe_udc_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct qe_ep *ep;
unsigned int ret = 0;
unsigned int i;
const void *prop;

if (!ofdev->dev.of_match)
return -EINVAL;

prop = of_get_property(np, "mode", NULL);
if (!prop || strcmp(prop, "peripheral"))
return -ENODEV;
Expand All @@ -2543,7 +2545,7 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev,
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);
if (!udc_controller->usb_regs) {
ret = -ENOMEM;
Expand Down Expand Up @@ -2768,7 +2770,7 @@ static const struct of_device_id qe_udc_match[] __devinitconst = {

MODULE_DEVICE_TABLE(of, qe_udc_match);

static struct of_platform_driver udc_driver = {
static struct platform_driver udc_driver = {
.driver = {
.name = (char *)driver_name,
.owner = THIS_MODULE,
Expand All @@ -2786,12 +2788,12 @@ static int __init qe_udc_init(void)
{
printk(KERN_INFO "%s: %s, %s\n", driver_name, driver_desc,
DRIVER_VERSION);
return of_register_platform_driver(&udc_driver);
return platform_driver_register(&udc_driver);
}

static void __exit qe_udc_exit(void)
{
of_unregister_platform_driver(&udc_driver);
platform_driver_unregister(&udc_driver);
}

module_init(qe_udc_init);
Expand Down
12 changes: 6 additions & 6 deletions drivers/usb/host/ehci-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1306,24 +1306,24 @@ static int __init ehci_hcd_init(void)
#endif

#ifdef OF_PLATFORM_DRIVER
retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
retval = platform_driver_register(&OF_PLATFORM_DRIVER);
if (retval < 0)
goto clean3;
#endif

#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)
goto clean4;
#endif
return retval;

#ifdef XILINX_OF_PLATFORM_DRIVER
/* of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); */
/* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */
clean4:
#endif
#ifdef OF_PLATFORM_DRIVER
of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
platform_driver_unregister(&OF_PLATFORM_DRIVER);
clean3:
#endif
#ifdef PS3_SYSTEM_BUS_DRIVER
Expand Down Expand Up @@ -1351,10 +1351,10 @@ module_init(ehci_hcd_init);
static void __exit ehci_hcd_cleanup(void)
{
#ifdef XILINX_OF_PLATFORM_DRIVER
of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER);
#endif
#ifdef OF_PLATFORM_DRIVER
of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
platform_driver_unregister(&OF_PLATFORM_DRIVER);
#endif
#ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
Expand Down
9 changes: 3 additions & 6 deletions drivers/usb/host/ehci-ppc-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ ppc44x_enable_bmt(struct device_node *dn)
}


static int __devinit
ehci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match)
static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op)
{
struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd;
Expand Down Expand Up @@ -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);

if (hcd->driver->shutdown)
hcd->driver->shutdown(hcd);

return 0;
}


Expand All @@ -275,7 +272,7 @@ static const struct of_device_id 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,
.remove = ehci_hcd_ppc_of_remove,
.shutdown = ehci_hcd_ppc_of_shutdown,
Expand Down
6 changes: 2 additions & 4 deletions drivers/usb/host/ehci-xilinx-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* @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
* 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
* entry, and sets an appropriate value for hcd->has_tt.
*/
static int __devinit
ehci_hcd_xilinx_of_probe(struct platform_device *op, const struct of_device_id *match)
static int __devinit ehci_hcd_xilinx_of_probe(struct platform_device *op)
{
struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd;
Expand Down Expand Up @@ -288,7 +286,7 @@ static const struct of_device_id 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,
.remove = ehci_hcd_xilinx_of_remove,
.shutdown = ehci_hcd_xilinx_of_shutdown,
Expand Down
9 changes: 4 additions & 5 deletions drivers/usb/host/fhci-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,7 @@ static const struct hc_driver fhci_driver = {
.hub_control = fhci_hub_control,
};

static int __devinit of_fhci_probe(struct platform_device *ofdev,
const struct of_device_id *ofid)
static int __devinit of_fhci_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *node = dev->of_node;
Expand Down Expand Up @@ -812,7 +811,7 @@ static const struct of_device_id 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 = {
.name = "fsl,usb-fhci",
.owner = THIS_MODULE,
Expand All @@ -824,13 +823,13 @@ static struct of_platform_driver of_fhci_driver = {

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);

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);

Expand Down
9 changes: 4 additions & 5 deletions drivers/usb/host/isp1760-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
#endif

#ifdef CONFIG_PPC_OF
static int of_isp1760_probe(struct platform_device *dev,
const struct of_device_id *match)
static int of_isp1760_probe(struct platform_device *dev)
{
struct usb_hcd *hcd;
struct device_node *dp = dev->dev.of_node;
Expand Down Expand Up @@ -119,7 +118,7 @@ static const struct of_device_id 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 = {
.name = "nxp-isp1760",
.owner = THIS_MODULE,
Expand Down Expand Up @@ -398,7 +397,7 @@ static int __init isp1760_init(void)
if (!ret)
any_ret = 0;
#ifdef CONFIG_PPC_OF
ret = of_register_platform_driver(&isp1760_of_driver);
ret = platform_driver_register(&isp1760_of_driver);
if (!ret)
any_ret = 0;
#endif
Expand All @@ -418,7 +417,7 @@ static void __exit isp1760_exit(void)
{
platform_driver_unregister(&isp1760_plat_driver);
#ifdef CONFIG_PPC_OF
of_unregister_platform_driver(&isp1760_of_driver);
platform_driver_unregister(&isp1760_of_driver);
#endif
#ifdef CONFIG_PCI
pci_unregister_driver(&isp1761_pci_driver);
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/host/ohci-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ static int __init ohci_hcd_mod_init(void)
#endif

#ifdef OF_PLATFORM_DRIVER
retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
retval = platform_driver_register(&OF_PLATFORM_DRIVER);
if (retval < 0)
goto error_of_platform;
#endif
Expand Down Expand Up @@ -1239,7 +1239,7 @@ static int __init ohci_hcd_mod_init(void)
error_sa1111:
#endif
#ifdef OF_PLATFORM_DRIVER
of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
platform_driver_unregister(&OF_PLATFORM_DRIVER);
error_of_platform:
#endif
#ifdef PLATFORM_DRIVER
Expand Down Expand Up @@ -1287,7 +1287,7 @@ static void __exit ohci_hcd_mod_exit(void)
sa1111_driver_unregister(&SA1111_DRIVER);
#endif
#ifdef OF_PLATFORM_DRIVER
of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
platform_driver_unregister(&OF_PLATFORM_DRIVER);
#endif
#ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
Expand Down
9 changes: 3 additions & 6 deletions drivers/usb/host/ohci-ppc-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ static const struct hc_driver ohci_ppc_of_hc_driver = {
};


static int __devinit
ohci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match)
static int __devinit ohci_hcd_ppc_of_probe(struct platform_device *op)
{
struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd;
Expand Down Expand Up @@ -201,14 +200,12 @@ static int ohci_hcd_ppc_of_remove(struct platform_device *op)
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);

if (hcd->driver->shutdown)
hcd->driver->shutdown(hcd);

return 0;
}


Expand Down Expand Up @@ -243,7 +240,7 @@ MODULE_DEVICE_TABLE(of, ohci_hcd_ppc_of_match);
#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,
.remove = ohci_hcd_ppc_of_remove,
.shutdown = ohci_hcd_ppc_of_shutdown,
Expand Down

0 comments on commit d35fb64

Please sign in to comment.