Skip to content

Commit

Permalink
dt/powerpc: Eliminate users of of_platform_{,un}register_driver
Browse files Browse the repository at this point in the history
Get rid of old users of of_platform_driver in arch/powerpc.  Most
of_platform_driver users can be converted to use the platform_bus
directly.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Grant Likely committed Feb 28, 2011
1 parent 710ac54 commit 0000612
Show file tree
Hide file tree
Showing 26 changed files with 120 additions and 161 deletions.
7 changes: 3 additions & 4 deletions arch/powerpc/kernel/of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
* lacking some bits needed here.
*/

static int __devinit of_pci_phb_probe(struct platform_device *dev,
const struct of_device_id *match)
static int __devinit of_pci_phb_probe(struct platform_device *dev)
{
struct pci_controller *phb;

Expand Down Expand Up @@ -104,7 +103,7 @@ static struct of_device_id of_pci_phb_ids[] = {
{}
};

static struct of_platform_driver of_pci_phb_driver = {
static struct platform_driver of_pci_phb_driver = {
.probe = of_pci_phb_probe,
.driver = {
.name = "of-pci",
Expand All @@ -115,7 +114,7 @@ static struct of_platform_driver of_pci_phb_driver = {

static __init int of_pci_phb_init(void)
{
return of_register_platform_driver(&of_pci_phb_driver);
return platform_driver_register(&of_pci_phb_driver);
}

device_initcall(of_pci_phb_init);
Expand Down
14 changes: 6 additions & 8 deletions arch/powerpc/platforms/52xx/mpc52xx_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
return 0;
}

static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev)
{
struct mpc52xx_gpiochip *chip;
struct mpc52xx_gpio_wkup __iomem *regs;
Expand Down Expand Up @@ -191,7 +190,7 @@ static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
{}
};

static struct of_platform_driver mpc52xx_wkup_gpiochip_driver = {
static struct platform_driver mpc52xx_wkup_gpiochip_driver = {
.driver = {
.name = "gpio_wkup",
.owner = THIS_MODULE,
Expand Down Expand Up @@ -310,8 +309,7 @@ mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
return 0;
}

static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev)
{
struct mpc52xx_gpiochip *chip;
struct gpio_chip *gc;
Expand Down Expand Up @@ -349,7 +347,7 @@ static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {
{}
};

static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {
static struct platform_driver mpc52xx_simple_gpiochip_driver = {
.driver = {
.name = "gpio",
.owner = THIS_MODULE,
Expand All @@ -361,10 +359,10 @@ static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {

static int __init mpc52xx_gpio_init(void)
{
if (of_register_platform_driver(&mpc52xx_wkup_gpiochip_driver))
if (platform_driver_register(&mpc52xx_wkup_gpiochip_driver))
printk(KERN_ERR "Unable to register wakeup GPIO driver\n");

if (of_register_platform_driver(&mpc52xx_simple_gpiochip_driver))
if (platform_driver_register(&mpc52xx_simple_gpiochip_driver))
printk(KERN_ERR "Unable to register simple GPIO driver\n");

return 0;
Expand Down
10 changes: 3 additions & 7 deletions arch/powerpc/platforms/52xx/mpc52xx_gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,7 @@ static inline int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt,
/* ---------------------------------------------------------------------
* of_platform bus binding code
*/
static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev)
{
struct mpc52xx_gpt_priv *gpt;

Expand Down Expand Up @@ -781,7 +780,7 @@ static const struct of_device_id mpc52xx_gpt_match[] = {
{}
};

static struct of_platform_driver mpc52xx_gpt_driver = {
static struct platform_driver mpc52xx_gpt_driver = {
.driver = {
.name = "mpc52xx-gpt",
.owner = THIS_MODULE,
Expand All @@ -793,10 +792,7 @@ static struct of_platform_driver mpc52xx_gpt_driver = {

static int __init mpc52xx_gpt_init(void)
{
if (of_register_platform_driver(&mpc52xx_gpt_driver))
pr_err("error registering MPC52xx GPT driver\n");

return 0;
return platform_driver_register(&mpc52xx_gpt_driver);
}

/* Make sure GPIOs and IRQs get set up before anyone tries to use them */
Expand Down
11 changes: 4 additions & 7 deletions arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,7 @@ void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req)
}
EXPORT_SYMBOL(mpc52xx_lpbfifo_abort);

static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op,
const struct of_device_id *match)
static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op)
{
struct resource res;
int rc = -ENOMEM;
Expand Down Expand Up @@ -536,7 +535,7 @@ static struct of_device_id mpc52xx_lpbfifo_match[] __devinitconst = {
{},
};

static struct of_platform_driver mpc52xx_lpbfifo_driver = {
static struct platform_driver mpc52xx_lpbfifo_driver = {
.driver = {
.name = "mpc52xx-lpbfifo",
.owner = THIS_MODULE,
Expand All @@ -551,14 +550,12 @@ static struct of_platform_driver mpc52xx_lpbfifo_driver = {
*/
static int __init mpc52xx_lpbfifo_init(void)
{
pr_debug("Registering LocalPlus bus FIFO driver\n");
return of_register_platform_driver(&mpc52xx_lpbfifo_driver);
return platform_driver_register(&mpc52xx_lpbfifo_driver);
}
module_init(mpc52xx_lpbfifo_init);

static void __exit mpc52xx_lpbfifo_exit(void)
{
pr_debug("Unregistering LocalPlus bus FIFO driver\n");
of_unregister_platform_driver(&mpc52xx_lpbfifo_driver);
platform_driver_unregister(&mpc52xx_lpbfifo_driver);
}
module_exit(mpc52xx_lpbfifo_exit);
7 changes: 3 additions & 4 deletions arch/powerpc/platforms/82xx/ep8248e.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ static struct mdiobb_ctrl ep8248e_mdio_ctrl = {
.ops = &ep8248e_mdio_ops,
};

static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev)
{
struct mii_bus *bus;
struct resource res;
Expand Down Expand Up @@ -167,7 +166,7 @@ static const struct of_device_id ep8248e_mdio_match[] = {
{},
};

static struct of_platform_driver ep8248e_mdio_driver = {
static struct platform_driver ep8248e_mdio_driver = {
.driver = {
.name = "ep8248e-mdio-bitbang",
.owner = THIS_MODULE,
Expand Down Expand Up @@ -308,7 +307,7 @@ static __initdata struct of_device_id of_bus_ids[] = {
static int __init declare_of_platform_devices(void)
{
of_platform_bus_probe(NULL, of_bus_ids, NULL);
of_register_platform_driver(&ep8248e_mdio_driver);
platform_driver_register(&ep8248e_mdio_driver);

return 0;
}
Expand Down
14 changes: 9 additions & 5 deletions arch/powerpc/platforms/83xx/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,18 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
.end = mpc83xx_suspend_end,
};

static int pmc_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int pmc_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct resource res;
struct pmc_type *type = match->data;
struct pmc_type *type;
int ret = 0;

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

type = ofdev->dev.of_match->data;

if (!of_device_is_available(np))
return -ENODEV;

Expand Down Expand Up @@ -422,7 +426,7 @@ static struct of_device_id pmc_match[] = {
{}
};

static struct of_platform_driver pmc_driver = {
static struct platform_driver pmc_driver = {
.driver = {
.name = "mpc83xx-pmc",
.owner = THIS_MODULE,
Expand All @@ -434,7 +438,7 @@ static struct of_platform_driver pmc_driver = {

static int pmc_init(void)
{
return of_register_platform_driver(&pmc_driver);
return platform_driver_register(&pmc_driver);
}

module_init(pmc_init);
11 changes: 4 additions & 7 deletions arch/powerpc/platforms/cell/axon_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static struct irq_host_ops msic_host_ops = {
.map = msic_host_map,
};

static int axon_msi_shutdown(struct platform_device *device)
static void axon_msi_shutdown(struct platform_device *device)
{
struct axon_msic *msic = dev_get_drvdata(&device->dev);
u32 tmp;
Expand All @@ -338,12 +338,9 @@ static int axon_msi_shutdown(struct platform_device *device)
tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG);
tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE;
msic_dcr_write(msic, MSIC_CTRL_REG, tmp);

return 0;
}

static int axon_msi_probe(struct platform_device *device,
const struct of_device_id *device_id)
static int axon_msi_probe(struct platform_device *device)
{
struct device_node *dn = device->dev.of_node;
struct axon_msic *msic;
Expand Down Expand Up @@ -446,7 +443,7 @@ static const struct of_device_id axon_msi_device_id[] = {
{}
};

static struct of_platform_driver axon_msi_driver = {
static struct platform_driver axon_msi_driver = {
.probe = axon_msi_probe,
.shutdown = axon_msi_shutdown,
.driver = {
Expand All @@ -458,7 +455,7 @@ static struct of_platform_driver axon_msi_driver = {

static int __init axon_msi_init(void)
{
return of_register_platform_driver(&axon_msi_driver);
return platform_driver_register(&axon_msi_driver);
}
subsys_initcall(axon_msi_init);

Expand Down
9 changes: 4 additions & 5 deletions arch/powerpc/platforms/pasemi/gpio_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ static int gpio_mdio_reset(struct mii_bus *bus)
}


static int __devinit gpio_mdio_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int __devinit gpio_mdio_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
Expand Down Expand Up @@ -299,7 +298,7 @@ static struct of_device_id gpio_mdio_match[] =
};
MODULE_DEVICE_TABLE(of, gpio_mdio_match);

static struct of_platform_driver gpio_mdio_driver =
static struct platform_driver gpio_mdio_driver =
{
.probe = gpio_mdio_probe,
.remove = gpio_mdio_remove,
Expand All @@ -326,13 +325,13 @@ int gpio_mdio_init(void)
if (!gpio_regs)
return -ENODEV;

return of_register_platform_driver(&gpio_mdio_driver);
return platform_driver_register(&gpio_mdio_driver);
}
module_init(gpio_mdio_init);

void gpio_mdio_exit(void)
{
of_unregister_platform_driver(&gpio_mdio_driver);
platform_driver_unregister(&gpio_mdio_driver);
if (gpio_regs)
iounmap(gpio_regs);
}
Expand Down
11 changes: 5 additions & 6 deletions arch/powerpc/sysdev/axonram.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,9 @@ static const struct block_device_operations axon_ram_devops = {

/**
* axon_ram_probe - probe() method for platform driver
* @device, @device_id: see of_platform_driver method
* @device: see platform_driver method
*/
static int axon_ram_probe(struct platform_device *device,
const struct of_device_id *device_id)
static int axon_ram_probe(struct platform_device *device)
{
static int axon_ram_bank_id = -1;
struct axon_ram_bank *bank;
Expand Down Expand Up @@ -326,7 +325,7 @@ static struct of_device_id axon_ram_device_id[] = {
{}
};

static struct of_platform_driver axon_ram_driver = {
static struct platform_driver axon_ram_driver = {
.probe = axon_ram_probe,
.remove = axon_ram_remove,
.driver = {
Expand All @@ -350,7 +349,7 @@ axon_ram_init(void)
}
azfs_minor = 0;

return of_register_platform_driver(&axon_ram_driver);
return platform_driver_register(&axon_ram_driver);
}

/**
Expand All @@ -359,7 +358,7 @@ axon_ram_init(void)
static void __exit
axon_ram_exit(void)
{
of_unregister_platform_driver(&axon_ram_driver);
platform_driver_unregister(&axon_ram_driver);
unregister_blkdev(azfs_major, AXON_RAM_DEVICE_NAME);
}

Expand Down
9 changes: 4 additions & 5 deletions arch/powerpc/sysdev/bestcomm/bestcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,7 @@ bcom_engine_cleanup(void)
/* OF platform driver */
/* ======================================================================== */

static int __devinit mpc52xx_bcom_probe(struct platform_device *op,
const struct of_device_id *match)
static int __devinit mpc52xx_bcom_probe(struct platform_device *op)
{
struct device_node *ofn_sram;
struct resource res_bcom;
Expand Down Expand Up @@ -492,7 +491,7 @@ static struct of_device_id mpc52xx_bcom_of_match[] = {
MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match);


static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
static struct platform_driver mpc52xx_bcom_of_platform_driver = {
.probe = mpc52xx_bcom_probe,
.remove = mpc52xx_bcom_remove,
.driver = {
Expand All @@ -510,13 +509,13 @@ static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
static int __init
mpc52xx_bcom_init(void)
{
return of_register_platform_driver(&mpc52xx_bcom_of_platform_driver);
return platform_driver_register(&mpc52xx_bcom_of_platform_driver);
}

static void __exit
mpc52xx_bcom_exit(void)
{
of_unregister_platform_driver(&mpc52xx_bcom_of_platform_driver);
platform_driver_unregister(&mpc52xx_bcom_of_platform_driver);
}

/* If we're not a module, we must make sure everything is setup before */
Expand Down
9 changes: 4 additions & 5 deletions arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ static int __init get_offset_from_cmdline(char *str)
__setup("cache-sram-size=", get_size_from_cmdline);
__setup("cache-sram-offset=", get_offset_from_cmdline);

static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev,
const struct of_device_id *match)
static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev)
{
long rval;
unsigned int rem;
Expand Down Expand Up @@ -204,7 +203,7 @@ static struct of_device_id mpc85xx_l2ctlr_of_match[] = {
{},
};

static struct of_platform_driver mpc85xx_l2ctlr_of_platform_driver = {
static struct platform_driver mpc85xx_l2ctlr_of_platform_driver = {
.driver = {
.name = "fsl-l2ctlr",
.owner = THIS_MODULE,
Expand All @@ -216,12 +215,12 @@ static struct of_platform_driver mpc85xx_l2ctlr_of_platform_driver = {

static __init int mpc85xx_l2ctlr_of_init(void)
{
return of_register_platform_driver(&mpc85xx_l2ctlr_of_platform_driver);
return platform_driver_register(&mpc85xx_l2ctlr_of_platform_driver);
}

static void __exit mpc85xx_l2ctlr_of_exit(void)
{
of_unregister_platform_driver(&mpc85xx_l2ctlr_of_platform_driver);
platform_driver_unregister(&mpc85xx_l2ctlr_of_platform_driver);
}

subsys_initcall(mpc85xx_l2ctlr_of_init);
Expand Down
Loading

0 comments on commit 0000612

Please sign in to comment.