Skip to content

Commit 0000612

Browse files
committed
dt/powerpc: Eliminate users of of_platform_{,un}register_driver
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>
1 parent 710ac54 commit 0000612

26 files changed

Lines changed: 120 additions & 161 deletions

File tree

‎arch/powerpc/kernel/of_platform.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
* lacking some bits needed here.
3737
*/
3838

39-
static int __devinit of_pci_phb_probe(struct platform_device *dev,
40-
const struct of_device_id *match)
39+
static int __devinit of_pci_phb_probe(struct platform_device *dev)
4140
{
4241
struct pci_controller *phb;
4342

@@ -104,7 +103,7 @@ static struct of_device_id of_pci_phb_ids[] = {
104103
{}
105104
};
106105

107-
static struct of_platform_driver of_pci_phb_driver = {
106+
static struct platform_driver of_pci_phb_driver = {
108107
.probe = of_pci_phb_probe,
109108
.driver = {
110109
.name = "of-pci",
@@ -115,7 +114,7 @@ static struct of_platform_driver of_pci_phb_driver = {
115114

116115
static __init int of_pci_phb_init(void)
117116
{
118-
return of_register_platform_driver(&of_pci_phb_driver);
117+
return platform_driver_register(&of_pci_phb_driver);
119118
}
120119

121120
device_initcall(of_pci_phb_init);

‎arch/powerpc/platforms/52xx/mpc52xx_gpio.c‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
147147
return 0;
148148
}
149149

150-
static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev,
151-
const struct of_device_id *match)
150+
static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev)
152151
{
153152
struct mpc52xx_gpiochip *chip;
154153
struct mpc52xx_gpio_wkup __iomem *regs;
@@ -191,7 +190,7 @@ static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
191190
{}
192191
};
193192

194-
static struct of_platform_driver mpc52xx_wkup_gpiochip_driver = {
193+
static struct platform_driver mpc52xx_wkup_gpiochip_driver = {
195194
.driver = {
196195
.name = "gpio_wkup",
197196
.owner = THIS_MODULE,
@@ -310,8 +309,7 @@ mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
310309
return 0;
311310
}
312311

313-
static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev,
314-
const struct of_device_id *match)
312+
static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev)
315313
{
316314
struct mpc52xx_gpiochip *chip;
317315
struct gpio_chip *gc;
@@ -349,7 +347,7 @@ static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {
349347
{}
350348
};
351349

352-
static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {
350+
static struct platform_driver mpc52xx_simple_gpiochip_driver = {
353351
.driver = {
354352
.name = "gpio",
355353
.owner = THIS_MODULE,
@@ -361,10 +359,10 @@ static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {
361359

362360
static int __init mpc52xx_gpio_init(void)
363361
{
364-
if (of_register_platform_driver(&mpc52xx_wkup_gpiochip_driver))
362+
if (platform_driver_register(&mpc52xx_wkup_gpiochip_driver))
365363
printk(KERN_ERR "Unable to register wakeup GPIO driver\n");
366364

367-
if (of_register_platform_driver(&mpc52xx_simple_gpiochip_driver))
365+
if (platform_driver_register(&mpc52xx_simple_gpiochip_driver))
368366
printk(KERN_ERR "Unable to register simple GPIO driver\n");
369367

370368
return 0;

‎arch/powerpc/platforms/52xx/mpc52xx_gpt.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,7 @@ static inline int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt,
721721
/* ---------------------------------------------------------------------
722722
* of_platform bus binding code
723723
*/
724-
static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev,
725-
const struct of_device_id *match)
724+
static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev)
726725
{
727726
struct mpc52xx_gpt_priv *gpt;
728727

@@ -781,7 +780,7 @@ static const struct of_device_id mpc52xx_gpt_match[] = {
781780
{}
782781
};
783782

784-
static struct of_platform_driver mpc52xx_gpt_driver = {
783+
static struct platform_driver mpc52xx_gpt_driver = {
785784
.driver = {
786785
.name = "mpc52xx-gpt",
787786
.owner = THIS_MODULE,
@@ -793,10 +792,7 @@ static struct of_platform_driver mpc52xx_gpt_driver = {
793792

794793
static int __init mpc52xx_gpt_init(void)
795794
{
796-
if (of_register_platform_driver(&mpc52xx_gpt_driver))
797-
pr_err("error registering MPC52xx GPT driver\n");
798-
799-
return 0;
795+
return platform_driver_register(&mpc52xx_gpt_driver);
800796
}
801797

802798
/* Make sure GPIOs and IRQs get set up before anyone tries to use them */

‎arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,7 @@ void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req)
436436
}
437437
EXPORT_SYMBOL(mpc52xx_lpbfifo_abort);
438438

439-
static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op,
440-
const struct of_device_id *match)
439+
static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op)
441440
{
442441
struct resource res;
443442
int rc = -ENOMEM;
@@ -536,7 +535,7 @@ static struct of_device_id mpc52xx_lpbfifo_match[] __devinitconst = {
536535
{},
537536
};
538537

539-
static struct of_platform_driver mpc52xx_lpbfifo_driver = {
538+
static struct platform_driver mpc52xx_lpbfifo_driver = {
540539
.driver = {
541540
.name = "mpc52xx-lpbfifo",
542541
.owner = THIS_MODULE,
@@ -551,14 +550,12 @@ static struct of_platform_driver mpc52xx_lpbfifo_driver = {
551550
*/
552551
static int __init mpc52xx_lpbfifo_init(void)
553552
{
554-
pr_debug("Registering LocalPlus bus FIFO driver\n");
555-
return of_register_platform_driver(&mpc52xx_lpbfifo_driver);
553+
return platform_driver_register(&mpc52xx_lpbfifo_driver);
556554
}
557555
module_init(mpc52xx_lpbfifo_init);
558556

559557
static void __exit mpc52xx_lpbfifo_exit(void)
560558
{
561-
pr_debug("Unregistering LocalPlus bus FIFO driver\n");
562-
of_unregister_platform_driver(&mpc52xx_lpbfifo_driver);
559+
platform_driver_unregister(&mpc52xx_lpbfifo_driver);
563560
}
564561
module_exit(mpc52xx_lpbfifo_exit);

‎arch/powerpc/platforms/82xx/ep8248e.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ static struct mdiobb_ctrl ep8248e_mdio_ctrl = {
111111
.ops = &ep8248e_mdio_ops,
112112
};
113113

114-
static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev,
115-
const struct of_device_id *match)
114+
static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev)
116115
{
117116
struct mii_bus *bus;
118117
struct resource res;
@@ -167,7 +166,7 @@ static const struct of_device_id ep8248e_mdio_match[] = {
167166
{},
168167
};
169168

170-
static struct of_platform_driver ep8248e_mdio_driver = {
169+
static struct platform_driver ep8248e_mdio_driver = {
171170
.driver = {
172171
.name = "ep8248e-mdio-bitbang",
173172
.owner = THIS_MODULE,
@@ -308,7 +307,7 @@ static __initdata struct of_device_id of_bus_ids[] = {
308307
static int __init declare_of_platform_devices(void)
309308
{
310309
of_platform_bus_probe(NULL, of_bus_ids, NULL);
311-
of_register_platform_driver(&ep8248e_mdio_driver);
310+
platform_driver_register(&ep8248e_mdio_driver);
312311

313312
return 0;
314313
}

‎arch/powerpc/platforms/83xx/suspend.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,18 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
318318
.end = mpc83xx_suspend_end,
319319
};
320320

321-
static int pmc_probe(struct platform_device *ofdev,
322-
const struct of_device_id *match)
321+
static int pmc_probe(struct platform_device *ofdev)
323322
{
324323
struct device_node *np = ofdev->dev.of_node;
325324
struct resource res;
326-
struct pmc_type *type = match->data;
325+
struct pmc_type *type;
327326
int ret = 0;
328327

328+
if (!ofdev->dev.of_match)
329+
return -EINVAL;
330+
331+
type = ofdev->dev.of_match->data;
332+
329333
if (!of_device_is_available(np))
330334
return -ENODEV;
331335

@@ -422,7 +426,7 @@ static struct of_device_id pmc_match[] = {
422426
{}
423427
};
424428

425-
static struct of_platform_driver pmc_driver = {
429+
static struct platform_driver pmc_driver = {
426430
.driver = {
427431
.name = "mpc83xx-pmc",
428432
.owner = THIS_MODULE,
@@ -434,7 +438,7 @@ static struct of_platform_driver pmc_driver = {
434438

435439
static int pmc_init(void)
436440
{
437-
return of_register_platform_driver(&pmc_driver);
441+
return platform_driver_register(&pmc_driver);
438442
}
439443

440444
module_init(pmc_init);

‎arch/powerpc/platforms/cell/axon_msi.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static struct irq_host_ops msic_host_ops = {
328328
.map = msic_host_map,
329329
};
330330

331-
static int axon_msi_shutdown(struct platform_device *device)
331+
static void axon_msi_shutdown(struct platform_device *device)
332332
{
333333
struct axon_msic *msic = dev_get_drvdata(&device->dev);
334334
u32 tmp;
@@ -338,12 +338,9 @@ static int axon_msi_shutdown(struct platform_device *device)
338338
tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG);
339339
tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE;
340340
msic_dcr_write(msic, MSIC_CTRL_REG, tmp);
341-
342-
return 0;
343341
}
344342

345-
static int axon_msi_probe(struct platform_device *device,
346-
const struct of_device_id *device_id)
343+
static int axon_msi_probe(struct platform_device *device)
347344
{
348345
struct device_node *dn = device->dev.of_node;
349346
struct axon_msic *msic;
@@ -446,7 +443,7 @@ static const struct of_device_id axon_msi_device_id[] = {
446443
{}
447444
};
448445

449-
static struct of_platform_driver axon_msi_driver = {
446+
static struct platform_driver axon_msi_driver = {
450447
.probe = axon_msi_probe,
451448
.shutdown = axon_msi_shutdown,
452449
.driver = {
@@ -458,7 +455,7 @@ static struct of_platform_driver axon_msi_driver = {
458455

459456
static int __init axon_msi_init(void)
460457
{
461-
return of_register_platform_driver(&axon_msi_driver);
458+
return platform_driver_register(&axon_msi_driver);
462459
}
463460
subsys_initcall(axon_msi_init);
464461

‎arch/powerpc/platforms/pasemi/gpio_mdio.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ static int gpio_mdio_reset(struct mii_bus *bus)
216216
}
217217

218218

219-
static int __devinit gpio_mdio_probe(struct platform_device *ofdev,
220-
const struct of_device_id *match)
219+
static int __devinit gpio_mdio_probe(struct platform_device *ofdev)
221220
{
222221
struct device *dev = &ofdev->dev;
223222
struct device_node *np = ofdev->dev.of_node;
@@ -299,7 +298,7 @@ static struct of_device_id gpio_mdio_match[] =
299298
};
300299
MODULE_DEVICE_TABLE(of, gpio_mdio_match);
301300

302-
static struct of_platform_driver gpio_mdio_driver =
301+
static struct platform_driver gpio_mdio_driver =
303302
{
304303
.probe = gpio_mdio_probe,
305304
.remove = gpio_mdio_remove,
@@ -326,13 +325,13 @@ int gpio_mdio_init(void)
326325
if (!gpio_regs)
327326
return -ENODEV;
328327

329-
return of_register_platform_driver(&gpio_mdio_driver);
328+
return platform_driver_register(&gpio_mdio_driver);
330329
}
331330
module_init(gpio_mdio_init);
332331

333332
void gpio_mdio_exit(void)
334333
{
335-
of_unregister_platform_driver(&gpio_mdio_driver);
334+
platform_driver_unregister(&gpio_mdio_driver);
336335
if (gpio_regs)
337336
iounmap(gpio_regs);
338337
}

‎arch/powerpc/sysdev/axonram.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,9 @@ static const struct block_device_operations axon_ram_devops = {
172172

173173
/**
174174
* axon_ram_probe - probe() method for platform driver
175-
* @device, @device_id: see of_platform_driver method
175+
* @device: see platform_driver method
176176
*/
177-
static int axon_ram_probe(struct platform_device *device,
178-
const struct of_device_id *device_id)
177+
static int axon_ram_probe(struct platform_device *device)
179178
{
180179
static int axon_ram_bank_id = -1;
181180
struct axon_ram_bank *bank;
@@ -326,7 +325,7 @@ static struct of_device_id axon_ram_device_id[] = {
326325
{}
327326
};
328327

329-
static struct of_platform_driver axon_ram_driver = {
328+
static struct platform_driver axon_ram_driver = {
330329
.probe = axon_ram_probe,
331330
.remove = axon_ram_remove,
332331
.driver = {
@@ -350,7 +349,7 @@ axon_ram_init(void)
350349
}
351350
azfs_minor = 0;
352351

353-
return of_register_platform_driver(&axon_ram_driver);
352+
return platform_driver_register(&axon_ram_driver);
354353
}
355354

356355
/**
@@ -359,7 +358,7 @@ axon_ram_init(void)
359358
static void __exit
360359
axon_ram_exit(void)
361360
{
362-
of_unregister_platform_driver(&axon_ram_driver);
361+
platform_driver_unregister(&axon_ram_driver);
363362
unregister_blkdev(azfs_major, AXON_RAM_DEVICE_NAME);
364363
}
365364

‎arch/powerpc/sysdev/bestcomm/bestcomm.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,7 @@ bcom_engine_cleanup(void)
365365
/* OF platform driver */
366366
/* ======================================================================== */
367367

368-
static int __devinit mpc52xx_bcom_probe(struct platform_device *op,
369-
const struct of_device_id *match)
368+
static int __devinit mpc52xx_bcom_probe(struct platform_device *op)
370369
{
371370
struct device_node *ofn_sram;
372371
struct resource res_bcom;
@@ -492,7 +491,7 @@ static struct of_device_id mpc52xx_bcom_of_match[] = {
492491
MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match);
493492

494493

495-
static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
494+
static struct platform_driver mpc52xx_bcom_of_platform_driver = {
496495
.probe = mpc52xx_bcom_probe,
497496
.remove = mpc52xx_bcom_remove,
498497
.driver = {
@@ -510,13 +509,13 @@ static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
510509
static int __init
511510
mpc52xx_bcom_init(void)
512511
{
513-
return of_register_platform_driver(&mpc52xx_bcom_of_platform_driver);
512+
return platform_driver_register(&mpc52xx_bcom_of_platform_driver);
514513
}
515514

516515
static void __exit
517516
mpc52xx_bcom_exit(void)
518517
{
519-
of_unregister_platform_driver(&mpc52xx_bcom_of_platform_driver);
518+
platform_driver_unregister(&mpc52xx_bcom_of_platform_driver);
520519
}
521520

522521
/* If we're not a module, we must make sure everything is setup before */

0 commit comments

Comments
 (0)