aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:28:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:28:10 -0400
commit4c5811bf463b0ef82fabbd1708f8bb2d753aeb18 (patch)
treeff37d31217c3804ca05de21a55a9b5ca1ca818b2 /arch/powerpc
parentf74b9444192c60603020c61d7915b72893137edc (diff)
parent9f15444fefdb33509132ff5c9be60cb315c44cb2 (diff)
Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6
* 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6: (21 commits) tty: serial: altera_jtaguart: Add device tree support tty: serial: altera_uart: Add devicetree support dt: eliminate of_platform_driver shim code dt: Eliminate of_platform_{,un}register_driver dt/serial: Eliminate users of of_platform_{,un}register_driver dt/usb: Eliminate users of of_platform_{,un}register_driver dt/video: Eliminate users of of_platform_{,un}register_driver dt/net: Eliminate users of of_platform_{,un}register_driver dt/sound: Eliminate users of of_platform_{,un}register_driver dt/spi: Eliminate users of of_platform_{,un}register_driver dt: uartlite: merge platform and of_platform driver bindings dt: xilinx_hwicap: merge platform and of_platform driver bindings ipmi: convert OF driver to platform driver leds/leds-gpio: merge platform_driver with of_platform_driver dt/sparc: Eliminate users of of_platform_{,un}register_driver dt/powerpc: Eliminate users of of_platform_{,un}register_driver dt/powerpc: move of_bus_type infrastructure to ibmebus drivercore/dt: add a match table pointer to struct device dt: Typo fix. altera_ps2: Add devicetree support ...
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h27
-rw-r--r--arch/powerpc/include/asm/pci.h2
-rw-r--r--arch/powerpc/kernel/ibmebus.c404
-rw-r--r--arch/powerpc/kernel/of_platform.c9
-rw-r--r--arch/powerpc/kernel/pci-common.c11
-rw-r--r--arch/powerpc/kernel/pci_32.c2
-rw-r--r--arch/powerpc/kernel/pci_64.c6
-rw-r--r--arch/powerpc/kernel/pci_dn.c9
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c4
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpio.c14
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpt.c10
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c11
-rw-r--r--arch/powerpc/platforms/82xx/ep8248e.c7
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c14
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c11
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c9
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c2
-rw-r--r--arch/powerpc/sysdev/axonram.c11
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm.c9
-rw-r--r--arch/powerpc/sysdev/fsl_85xx_l2ctlr.c9
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c13
-rw-r--r--arch/powerpc/sysdev/fsl_pmc.c7
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c7
-rw-r--r--arch/powerpc/sysdev/pmi.c9
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c7
25 files changed, 493 insertions, 131 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index edeb80fdd2c..5e156e034fe 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -164,13 +164,13 @@ extern void setup_indirect_pci(struct pci_controller* hose,
164 resource_size_t cfg_addr, 164 resource_size_t cfg_addr,
165 resource_size_t cfg_data, u32 flags); 165 resource_size_t cfg_data, u32 flags);
166 166
167#ifndef CONFIG_PPC64
168
169static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) 167static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
170{ 168{
171 return bus->sysdata; 169 return bus->sysdata;
172} 170}
173 171
172#ifndef CONFIG_PPC64
173
174static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) 174static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
175{ 175{
176 struct pci_controller *host; 176 struct pci_controller *host;
@@ -228,19 +228,10 @@ extern void * update_dn_pci_info(struct device_node *dn, void *data);
228 228
229/* Get a device_node from a pci_dev. This code must be fast except 229/* Get a device_node from a pci_dev. This code must be fast except
230 * in the case where the sysdata is incorrect and needs to be fixed 230 * in the case where the sysdata is incorrect and needs to be fixed
231 * up (this will only happen once). 231 * up (this will only happen once). */
232 * In this case the sysdata will have been inherited from a PCI host
233 * bridge or a PCI-PCI bridge further up the tree, so it will point
234 * to a valid struct pci_dn, just not the one we want.
235 */
236static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) 232static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
237{ 233{
238 struct device_node *dn = dev->sysdata; 234 return dev->dev.of_node ? dev->dev.of_node : fetch_dev_dn(dev);
239 struct pci_dn *pdn = dn->data;
240
241 if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number)
242 return dn; /* fast path. sysdata is good */
243 return fetch_dev_dn(dev);
244} 235}
245 236
246static inline int pci_device_from_OF_node(struct device_node *np, 237static inline int pci_device_from_OF_node(struct device_node *np,
@@ -258,7 +249,7 @@ static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
258 if (bus->self) 249 if (bus->self)
259 return pci_device_to_OF_node(bus->self); 250 return pci_device_to_OF_node(bus->self);
260 else 251 else
261 return bus->sysdata; /* Must be root bus (PHB) */ 252 return bus->dev.of_node; /* Must be root bus (PHB) */
262} 253}
263 254
264/** Find the bus corresponding to the indicated device node */ 255/** Find the bus corresponding to the indicated device node */
@@ -270,14 +261,6 @@ extern void pcibios_remove_pci_devices(struct pci_bus *bus);
270/** Discover new pci devices under this bus, and add them */ 261/** Discover new pci devices under this bus, and add them */
271extern void pcibios_add_pci_devices(struct pci_bus *bus); 262extern void pcibios_add_pci_devices(struct pci_bus *bus);
272 263
273static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
274{
275 struct device_node *busdn = bus->sysdata;
276
277 BUG_ON(busdn == NULL);
278 return PCI_DN(busdn)->phb;
279}
280
281 264
282extern void isa_bridge_find_early(struct pci_controller *hose); 265extern void isa_bridge_find_early(struct pci_controller *hose);
283 266
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index a20a9ad2258..7d7790954e0 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -201,7 +201,7 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
201extern void pcibios_setup_bus_devices(struct pci_bus *bus); 201extern void pcibios_setup_bus_devices(struct pci_bus *bus);
202extern void pcibios_setup_bus_self(struct pci_bus *bus); 202extern void pcibios_setup_bus_self(struct pci_bus *bus);
203extern void pcibios_setup_phb_io_space(struct pci_controller *hose); 203extern void pcibios_setup_phb_io_space(struct pci_controller *hose);
204extern void pcibios_scan_phb(struct pci_controller *hose, void *sysdata); 204extern void pcibios_scan_phb(struct pci_controller *hose);
205 205
206#endif /* __KERNEL__ */ 206#endif /* __KERNEL__ */
207#endif /* __ASM_POWERPC_PCI_H */ 207#endif /* __ASM_POWERPC_PCI_H */
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index f62efdfd176..c00d4ca1ee1 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -201,13 +201,14 @@ int ibmebus_register_driver(struct of_platform_driver *drv)
201 /* If the driver uses devices that ibmebus doesn't know, add them */ 201 /* If the driver uses devices that ibmebus doesn't know, add them */
202 ibmebus_create_devices(drv->driver.of_match_table); 202 ibmebus_create_devices(drv->driver.of_match_table);
203 203
204 return of_register_driver(drv, &ibmebus_bus_type); 204 drv->driver.bus = &ibmebus_bus_type;
205 return driver_register(&drv->driver);
205} 206}
206EXPORT_SYMBOL(ibmebus_register_driver); 207EXPORT_SYMBOL(ibmebus_register_driver);
207 208
208void ibmebus_unregister_driver(struct of_platform_driver *drv) 209void ibmebus_unregister_driver(struct of_platform_driver *drv)
209{ 210{
210 of_unregister_driver(drv); 211 driver_unregister(&drv->driver);
211} 212}
212EXPORT_SYMBOL(ibmebus_unregister_driver); 213EXPORT_SYMBOL(ibmebus_unregister_driver);
213 214
@@ -308,15 +309,410 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
308 } 309 }
309} 310}
310 311
312
311static struct bus_attribute ibmebus_bus_attrs[] = { 313static struct bus_attribute ibmebus_bus_attrs[] = {
312 __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe), 314 __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe),
313 __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove), 315 __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove),
314 __ATTR_NULL 316 __ATTR_NULL
315}; 317};
316 318
319static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv)
320{
321 const struct of_device_id *matches = drv->of_match_table;
322
323 if (!matches)
324 return 0;
325
326 return of_match_device(matches, dev) != NULL;
327}
328
329static int ibmebus_bus_device_probe(struct device *dev)
330{
331 int error = -ENODEV;
332 struct of_platform_driver *drv;
333 struct platform_device *of_dev;
334 const struct of_device_id *match;
335
336 drv = to_of_platform_driver(dev->driver);
337 of_dev = to_platform_device(dev);
338
339 if (!drv->probe)
340 return error;
341
342 of_dev_get(of_dev);
343
344 match = of_match_device(drv->driver.of_match_table, dev);
345 if (match)
346 error = drv->probe(of_dev, match);
347 if (error)
348 of_dev_put(of_dev);
349
350 return error;
351}
352
353static int ibmebus_bus_device_remove(struct device *dev)
354{
355 struct platform_device *of_dev = to_platform_device(dev);
356 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
357
358 if (dev->driver && drv->remove)
359 drv->remove(of_dev);
360 return 0;
361}
362
363static void ibmebus_bus_device_shutdown(struct device *dev)
364{
365 struct platform_device *of_dev = to_platform_device(dev);
366 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
367
368 if (dev->driver && drv->shutdown)
369 drv->shutdown(of_dev);
370}
371
372/*
373 * ibmebus_bus_device_attrs
374 */
375static ssize_t devspec_show(struct device *dev,
376 struct device_attribute *attr, char *buf)
377{
378 struct platform_device *ofdev;
379
380 ofdev = to_platform_device(dev);
381 return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
382}
383
384static ssize_t name_show(struct device *dev,
385 struct device_attribute *attr, char *buf)
386{
387 struct platform_device *ofdev;
388
389 ofdev = to_platform_device(dev);
390 return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
391}
392
393static ssize_t modalias_show(struct device *dev,
394 struct device_attribute *attr, char *buf)
395{
396 ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);
397 buf[len] = '\n';
398 buf[len+1] = 0;
399 return len+1;
400}
401
402struct device_attribute ibmebus_bus_device_attrs[] = {
403 __ATTR_RO(devspec),
404 __ATTR_RO(name),
405 __ATTR_RO(modalias),
406 __ATTR_NULL
407};
408
409#ifdef CONFIG_PM_SLEEP
410static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
411{
412 struct platform_device *of_dev = to_platform_device(dev);
413 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
414 int ret = 0;
415
416 if (dev->driver && drv->suspend)
417 ret = drv->suspend(of_dev, mesg);
418 return ret;
419}
420
421static int ibmebus_bus_legacy_resume(struct device *dev)
422{
423 struct platform_device *of_dev = to_platform_device(dev);
424 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
425 int ret = 0;
426
427 if (dev->driver && drv->resume)
428 ret = drv->resume(of_dev);
429 return ret;
430}
431
432static int ibmebus_bus_pm_prepare(struct device *dev)
433{
434 struct device_driver *drv = dev->driver;
435 int ret = 0;
436
437 if (drv && drv->pm && drv->pm->prepare)
438 ret = drv->pm->prepare(dev);
439
440 return ret;
441}
442
443static void ibmebus_bus_pm_complete(struct device *dev)
444{
445 struct device_driver *drv = dev->driver;
446
447 if (drv && drv->pm && drv->pm->complete)
448 drv->pm->complete(dev);
449}
450
451#ifdef CONFIG_SUSPEND
452
453static int ibmebus_bus_pm_suspend(struct device *dev)
454{
455 struct device_driver *drv = dev->driver;
456 int ret = 0;
457
458 if (!drv)
459 return 0;
460
461 if (drv->pm) {
462 if (drv->pm->suspend)
463 ret = drv->pm->suspend(dev);
464 } else {
465 ret = ibmebus_bus_legacy_suspend(dev, PMSG_SUSPEND);
466 }
467
468 return ret;
469}
470
471static int ibmebus_bus_pm_suspend_noirq(struct device *dev)
472{
473 struct device_driver *drv = dev->driver;
474 int ret = 0;
475
476 if (!drv)
477 return 0;
478
479 if (drv->pm) {
480 if (drv->pm->suspend_noirq)
481 ret = drv->pm->suspend_noirq(dev);
482 }
483
484 return ret;
485}
486
487static int ibmebus_bus_pm_resume(struct device *dev)
488{
489 struct device_driver *drv = dev->driver;
490 int ret = 0;
491
492 if (!drv)
493 return 0;
494
495 if (drv->pm) {
496 if (drv->pm->resume)
497 ret = drv->pm->resume(dev);
498 } else {
499 ret = ibmebus_bus_legacy_resume(dev);
500 }
501
502 return ret;
503}
504
505static int ibmebus_bus_pm_resume_noirq(struct device *dev)
506{
507 struct device_driver *drv = dev->driver;
508 int ret = 0;
509
510 if (!drv)
511 return 0;
512
513 if (drv->pm) {
514 if (drv->pm->resume_noirq)
515 ret = drv->pm->resume_noirq(dev);
516 }
517
518 return ret;
519}
520
521#else /* !CONFIG_SUSPEND */
522
523#define ibmebus_bus_pm_suspend NULL
524#define ibmebus_bus_pm_resume NULL
525#define ibmebus_bus_pm_suspend_noirq NULL
526#define ibmebus_bus_pm_resume_noirq NULL
527
528#endif /* !CONFIG_SUSPEND */
529
530#ifdef CONFIG_HIBERNATION
531
532static int ibmebus_bus_pm_freeze(struct device *dev)
533{
534 struct device_driver *drv = dev->driver;
535 int ret = 0;
536
537 if (!drv)
538 return 0;
539
540 if (drv->pm) {
541 if (drv->pm->freeze)
542 ret = drv->pm->freeze(dev);
543 } else {
544 ret = ibmebus_bus_legacy_suspend(dev, PMSG_FREEZE);
545 }
546
547 return ret;
548}
549
550static int ibmebus_bus_pm_freeze_noirq(struct device *dev)
551{
552 struct device_driver *drv = dev->driver;
553 int ret = 0;
554
555 if (!drv)
556 return 0;
557
558 if (drv->pm) {
559 if (drv->pm->freeze_noirq)
560 ret = drv->pm->freeze_noirq(dev);
561 }
562
563 return ret;
564}
565
566static int ibmebus_bus_pm_thaw(struct device *dev)
567{
568 struct device_driver *drv = dev->driver;
569 int ret = 0;
570
571 if (!drv)
572 return 0;
573
574 if (drv->pm) {
575 if (drv->pm->thaw)
576 ret = drv->pm->thaw(dev);
577 } else {
578 ret = ibmebus_bus_legacy_resume(dev);
579 }
580
581 return ret;
582}
583
584static int ibmebus_bus_pm_thaw_noirq(struct device *dev)
585{
586 struct device_driver *drv = dev->driver;
587 int ret = 0;
588
589 if (!drv)
590 return 0;
591
592 if (drv->pm) {
593 if (drv->pm->thaw_noirq)
594 ret = drv->pm->thaw_noirq(dev);
595 }
596
597 return ret;
598}
599
600static int ibmebus_bus_pm_poweroff(struct device *dev)
601{
602 struct device_driver *drv = dev->driver;
603 int ret = 0;
604
605 if (!drv)
606 return 0;
607
608 if (drv->pm) {
609 if (drv->pm->poweroff)
610 ret = drv->pm->poweroff(dev);
611 } else {
612 ret = ibmebus_bus_legacy_suspend(dev, PMSG_HIBERNATE);
613 }
614
615 return ret;
616}
617
618static int ibmebus_bus_pm_poweroff_noirq(struct device *dev)
619{
620 struct device_driver *drv = dev->driver;
621 int ret = 0;
622
623 if (!drv)
624 return 0;
625
626 if (drv->pm) {
627 if (drv->pm->poweroff_noirq)
628 ret = drv->pm->poweroff_noirq(dev);
629 }
630
631 return ret;
632}
633
634static int ibmebus_bus_pm_restore(struct device *dev)
635{
636 struct device_driver *drv = dev->driver;
637 int ret = 0;
638
639 if (!drv)
640 return 0;
641
642 if (drv->pm) {
643 if (drv->pm->restore)
644 ret = drv->pm->restore(dev);
645 } else {
646 ret = ibmebus_bus_legacy_resume(dev);
647 }
648
649 return ret;
650}
651
652static int ibmebus_bus_pm_restore_noirq(struct device *dev)
653{
654 struct device_driver *drv = dev->driver;
655 int ret = 0;
656
657 if (!drv)
658 return 0;
659
660 if (drv->pm) {
661 if (drv->pm->restore_noirq)
662 ret = drv->pm->restore_noirq(dev);
663 }
664
665 return ret;
666}
667
668#else /* !CONFIG_HIBERNATION */
669
670#define ibmebus_bus_pm_freeze NULL
671#define ibmebus_bus_pm_thaw NULL
672#define ibmebus_bus_pm_poweroff NULL
673#define ibmebus_bus_pm_restore NULL
674#define ibmebus_bus_pm_freeze_noirq NULL
675#define ibmebus_bus_pm_thaw_noirq NULL
676#define ibmebus_bus_pm_poweroff_noirq NULL
677#define ibmebus_bus_pm_restore_noirq NULL
678
679#endif /* !CONFIG_HIBERNATION */
680
681static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
682 .prepare = ibmebus_bus_pm_prepare,
683 .complete = ibmebus_bus_pm_complete,
684 .suspend = ibmebus_bus_pm_suspend,
685 .resume = ibmebus_bus_pm_resume,
686 .freeze = ibmebus_bus_pm_freeze,
687 .thaw = ibmebus_bus_pm_thaw,
688 .poweroff = ibmebus_bus_pm_poweroff,
689 .restore = ibmebus_bus_pm_restore,
690 .suspend_noirq = ibmebus_bus_pm_suspend_noirq,
691 .resume_noirq = ibmebus_bus_pm_resume_noirq,
692 .freeze_noirq = ibmebus_bus_pm_freeze_noirq,
693 .thaw_noirq = ibmebus_bus_pm_thaw_noirq,
694 .poweroff_noirq = ibmebus_bus_pm_poweroff_noirq,
695 .restore_noirq = ibmebus_bus_pm_restore_noirq,
696};
697
698#define IBMEBUS_BUS_PM_OPS_PTR (&ibmebus_bus_dev_pm_ops)
699
700#else /* !CONFIG_PM_SLEEP */
701
702#define IBMEBUS_BUS_PM_OPS_PTR NULL
703
704#endif /* !CONFIG_PM_SLEEP */
705
317struct bus_type ibmebus_bus_type = { 706struct bus_type ibmebus_bus_type = {
707 .name = "ibmebus",
318 .uevent = of_device_uevent, 708 .uevent = of_device_uevent,
319 .bus_attrs = ibmebus_bus_attrs 709 .bus_attrs = ibmebus_bus_attrs,
710 .match = ibmebus_bus_bus_match,
711 .probe = ibmebus_bus_device_probe,
712 .remove = ibmebus_bus_device_remove,
713 .shutdown = ibmebus_bus_device_shutdown,
714 .dev_attrs = ibmebus_bus_device_attrs,
715 .pm = IBMEBUS_BUS_PM_OPS_PTR,
320}; 716};
321EXPORT_SYMBOL(ibmebus_bus_type); 717EXPORT_SYMBOL(ibmebus_bus_type);
322 718
@@ -326,7 +722,7 @@ static int __init ibmebus_bus_init(void)
326 722
327 printk(KERN_INFO "IBM eBus Device Driver\n"); 723 printk(KERN_INFO "IBM eBus Device Driver\n");
328 724
329 err = of_bus_type_init(&ibmebus_bus_type, "ibmebus"); 725 err = bus_register(&ibmebus_bus_type);
330 if (err) { 726 if (err) {
331 printk(KERN_ERR "%s: failed to register IBM eBus.\n", 727 printk(KERN_ERR "%s: failed to register IBM eBus.\n",
332 __func__); 728 __func__);
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index b2c363ef38a..24582181b6e 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -36,8 +36,7 @@
36 * lacking some bits needed here. 36 * lacking some bits needed here.
37 */ 37 */
38 38
39static int __devinit of_pci_phb_probe(struct platform_device *dev, 39static int __devinit of_pci_phb_probe(struct platform_device *dev)
40 const struct of_device_id *match)
41{ 40{
42 struct pci_controller *phb; 41 struct pci_controller *phb;
43 42
@@ -74,7 +73,7 @@ static int __devinit of_pci_phb_probe(struct platform_device *dev,
74#endif /* CONFIG_EEH */ 73#endif /* CONFIG_EEH */
75 74
76 /* Scan the bus */ 75 /* Scan the bus */
77 pcibios_scan_phb(phb, dev->dev.of_node); 76 pcibios_scan_phb(phb);
78 if (phb->bus == NULL) 77 if (phb->bus == NULL)
79 return -ENXIO; 78 return -ENXIO;
80 79
@@ -104,7 +103,7 @@ static struct of_device_id of_pci_phb_ids[] = {
104 {} 103 {}
105}; 104};
106 105
107static struct of_platform_driver of_pci_phb_driver = { 106static struct platform_driver of_pci_phb_driver = {
108 .probe = of_pci_phb_probe, 107 .probe = of_pci_phb_probe,
109 .driver = { 108 .driver = {
110 .name = "of-pci", 109 .name = "of-pci",
@@ -115,7 +114,7 @@ static struct of_platform_driver of_pci_phb_driver = {
115 114
116static __init int of_pci_phb_init(void) 115static __init int of_pci_phb_init(void)
117{ 116{
118 return of_register_platform_driver(&of_pci_phb_driver); 117 return platform_driver_register(&of_pci_phb_driver);
119} 118}
120 119
121device_initcall(of_pci_phb_init); 120device_initcall(of_pci_phb_init);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index eb341be9a4d..3cd85faa8ac 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1688,13 +1688,8 @@ int early_find_capability(struct pci_controller *hose, int bus, int devfn,
1688/** 1688/**
1689 * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus 1689 * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
1690 * @hose: Pointer to the PCI host controller instance structure 1690 * @hose: Pointer to the PCI host controller instance structure
1691 * @sysdata: value to use for sysdata pointer. ppc32 and ppc64 differ here
1692 *
1693 * Note: the 'data' pointer is a temporary measure. As 32 and 64 bit
1694 * pci code gets merged, this parameter should become unnecessary because
1695 * both will use the same value.
1696 */ 1691 */
1697void __devinit pcibios_scan_phb(struct pci_controller *hose, void *sysdata) 1692void __devinit pcibios_scan_phb(struct pci_controller *hose)
1698{ 1693{
1699 struct pci_bus *bus; 1694 struct pci_bus *bus;
1700 struct device_node *node = hose->dn; 1695 struct device_node *node = hose->dn;
@@ -1704,13 +1699,13 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose, void *sysdata)
1704 node ? node->full_name : "<NO NAME>"); 1699 node ? node->full_name : "<NO NAME>");
1705 1700
1706 /* Create an empty bus for the toplevel */ 1701 /* Create an empty bus for the toplevel */
1707 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, 1702 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose);
1708 sysdata);
1709 if (bus == NULL) { 1703 if (bus == NULL) {
1710 pr_err("Failed to create bus for PCI domain %04x\n", 1704 pr_err("Failed to create bus for PCI domain %04x\n",
1711 hose->global_number); 1705 hose->global_number);
1712 return; 1706 return;
1713 } 1707 }
1708 bus->dev.of_node = of_node_get(node);
1714 bus->secondary = hose->first_busno; 1709 bus->secondary = hose->first_busno;
1715 hose->bus = bus; 1710 hose->bus = bus;
1716 1711
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index e7db5b48004..bedb370459f 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -381,7 +381,7 @@ static int __init pcibios_init(void)
381 if (pci_assign_all_buses) 381 if (pci_assign_all_buses)
382 hose->first_busno = next_busno; 382 hose->first_busno = next_busno;
383 hose->last_busno = 0xff; 383 hose->last_busno = 0xff;
384 pcibios_scan_phb(hose, hose); 384 pcibios_scan_phb(hose);
385 pci_bus_add_devices(hose->bus); 385 pci_bus_add_devices(hose->bus);
386 if (pci_assign_all_buses || next_busno <= hose->last_busno) 386 if (pci_assign_all_buses || next_busno <= hose->last_busno)
387 next_busno = hose->last_busno + pcibios_assign_bus_offset; 387 next_busno = hose->last_busno + pcibios_assign_bus_offset;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 851577608a7..fc6452b6be9 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -64,7 +64,7 @@ static int __init pcibios_init(void)
64 64
65 /* Scan all of the recorded PCI controllers. */ 65 /* Scan all of the recorded PCI controllers. */
66 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 66 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
67 pcibios_scan_phb(hose, hose->dn); 67 pcibios_scan_phb(hose);
68 pci_bus_add_devices(hose->bus); 68 pci_bus_add_devices(hose->bus);
69 } 69 }
70 70
@@ -242,10 +242,10 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
242 break; 242 break;
243 bus = NULL; 243 bus = NULL;
244 } 244 }
245 if (bus == NULL || bus->sysdata == NULL) 245 if (bus == NULL || bus->dev.of_node == NULL)
246 return -ENODEV; 246 return -ENODEV;
247 247
248 hose_node = (struct device_node *)bus->sysdata; 248 hose_node = bus->dev.of_node;
249 hose = PCI_DN(hose_node)->phb; 249 hose = PCI_DN(hose_node)->phb;
250 250
251 switch (which) { 251 switch (which) {
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index d56b35ee7f7..29852688cea 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -161,7 +161,7 @@ static void *is_devfn_node(struct device_node *dn, void *data)
161/* 161/*
162 * This is the "slow" path for looking up a device_node from a 162 * This is the "slow" path for looking up a device_node from a
163 * pci_dev. It will hunt for the device under its parent's 163 * pci_dev. It will hunt for the device under its parent's
164 * phb and then update sysdata for a future fastpath. 164 * phb and then update of_node pointer.
165 * 165 *
166 * It may also do fixups on the actual device since this happens 166 * It may also do fixups on the actual device since this happens
167 * on the first read/write. 167 * on the first read/write.
@@ -170,16 +170,19 @@ static void *is_devfn_node(struct device_node *dn, void *data)
170 * In this case it may probe for real hardware ("just in case") 170 * In this case it may probe for real hardware ("just in case")
171 * and add a device_node to the device tree if necessary. 171 * and add a device_node to the device tree if necessary.
172 * 172 *
173 * Is this function necessary anymore now that dev->dev.of_node is
174 * used to store the node pointer?
175 *
173 */ 176 */
174struct device_node *fetch_dev_dn(struct pci_dev *dev) 177struct device_node *fetch_dev_dn(struct pci_dev *dev)
175{ 178{
176 struct device_node *orig_dn = dev->sysdata; 179 struct device_node *orig_dn = dev->dev.of_node;
177 struct device_node *dn; 180 struct device_node *dn;
178 unsigned long searchval = (dev->bus->number << 8) | dev->devfn; 181 unsigned long searchval = (dev->bus->number << 8) | dev->devfn;
179 182
180 dn = traverse_pci_devices(orig_dn, is_devfn_node, (void *)searchval); 183 dn = traverse_pci_devices(orig_dn, is_devfn_node, (void *)searchval);
181 if (dn) 184 if (dn)
182 dev->sysdata = dn; 185 dev->dev.of_node = dn;
183 return dn; 186 return dn;
184} 187}
185EXPORT_SYMBOL(fetch_dev_dn); 188EXPORT_SYMBOL(fetch_dev_dn);
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index e751506323b..1e89a72fd03 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -135,7 +135,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
135 pr_debug(" create device, devfn: %x, type: %s\n", devfn, type); 135 pr_debug(" create device, devfn: %x, type: %s\n", devfn, type);
136 136
137 dev->bus = bus; 137 dev->bus = bus;
138 dev->sysdata = node; 138 dev->dev.of_node = of_node_get(node);
139 dev->dev.parent = bus->bridge; 139 dev->dev.parent = bus->bridge;
140 dev->dev.bus = &pci_bus_type; 140 dev->dev.bus = &pci_bus_type;
141 dev->devfn = devfn; 141 dev->devfn = devfn;
@@ -238,7 +238,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
238 bus->primary = dev->bus->number; 238 bus->primary = dev->bus->number;
239 bus->subordinate = busrange[1]; 239 bus->subordinate = busrange[1];
240 bus->bridge_ctl = 0; 240 bus->bridge_ctl = 0;
241 bus->sysdata = node; 241 bus->dev.of_node = of_node_get(node);
242 242
243 /* parse ranges property */ 243 /* parse ranges property */
244 /* PCI #address-cells == 3 and #size-cells == 2 always */ 244 /* PCI #address-cells == 3 and #size-cells == 2 always */
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index 0dad9a935eb..1757d1db4b5 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
@@ -147,8 +147,7 @@ mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
147 return 0; 147 return 0;
148} 148}
149 149
150static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev, 150static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev)
151 const struct of_device_id *match)
152{ 151{
153 struct mpc52xx_gpiochip *chip; 152 struct mpc52xx_gpiochip *chip;
154 struct mpc52xx_gpio_wkup __iomem *regs; 153 struct mpc52xx_gpio_wkup __iomem *regs;
@@ -191,7 +190,7 @@ static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
191 {} 190 {}
192}; 191};
193 192
194static struct of_platform_driver mpc52xx_wkup_gpiochip_driver = { 193static struct platform_driver mpc52xx_wkup_gpiochip_driver = {
195 .driver = { 194 .driver = {
196 .name = "gpio_wkup", 195 .name = "gpio_wkup",
197 .owner = THIS_MODULE, 196 .owner = THIS_MODULE,
@@ -310,8 +309,7 @@ mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
310 return 0; 309 return 0;
311} 310}
312 311
313static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev, 312static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev)
314 const struct of_device_id *match)
315{ 313{
316 struct mpc52xx_gpiochip *chip; 314 struct mpc52xx_gpiochip *chip;
317 struct gpio_chip *gc; 315 struct gpio_chip *gc;
@@ -349,7 +347,7 @@ static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {
349 {} 347 {}
350}; 348};
351 349
352static struct of_platform_driver mpc52xx_simple_gpiochip_driver = { 350static struct platform_driver mpc52xx_simple_gpiochip_driver = {
353 .driver = { 351 .driver = {
354 .name = "gpio", 352 .name = "gpio",
355 .owner = THIS_MODULE, 353 .owner = THIS_MODULE,
@@ -361,10 +359,10 @@ static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {
361 359
362static int __init mpc52xx_gpio_init(void) 360static int __init mpc52xx_gpio_init(void)
363{ 361{
364 if (of_register_platform_driver(&mpc52xx_wkup_gpiochip_driver)) 362 if (platform_driver_register(&mpc52xx_wkup_gpiochip_driver))
365 printk(KERN_ERR "Unable to register wakeup GPIO driver\n"); 363 printk(KERN_ERR "Unable to register wakeup GPIO driver\n");
366 364
367 if (of_register_platform_driver(&mpc52xx_simple_gpiochip_driver)) 365 if (platform_driver_register(&mpc52xx_simple_gpiochip_driver))
368 printk(KERN_ERR "Unable to register simple GPIO driver\n"); 366 printk(KERN_ERR "Unable to register simple GPIO driver\n");
369 367
370 return 0; 368 return 0;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index e0d703c7fdf..859abf1c6d4 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -721,8 +721,7 @@ static inline int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt,
721/* --------------------------------------------------------------------- 721/* ---------------------------------------------------------------------
722 * of_platform bus binding code 722 * of_platform bus binding code
723 */ 723 */
724static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev, 724static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev)
725 const struct of_device_id *match)
726{ 725{
727 struct mpc52xx_gpt_priv *gpt; 726 struct mpc52xx_gpt_priv *gpt;
728 727
@@ -781,7 +780,7 @@ static const struct of_device_id mpc52xx_gpt_match[] = {
781 {} 780 {}
782}; 781};
783 782
784static struct of_platform_driver mpc52xx_gpt_driver = { 783static struct platform_driver mpc52xx_gpt_driver = {
785 .driver = { 784 .driver = {
786 .name = "mpc52xx-gpt", 785 .name = "mpc52xx-gpt",
787 .owner = THIS_MODULE, 786 .owner = THIS_MODULE,
@@ -793,10 +792,7 @@ static struct of_platform_driver mpc52xx_gpt_driver = {
793 792
794static int __init mpc52xx_gpt_init(void) 793static int __init mpc52xx_gpt_init(void)
795{ 794{
796 if (of_register_platform_driver(&mpc52xx_gpt_driver)) 795 return platform_driver_register(&mpc52xx_gpt_driver);
797 pr_err("error registering MPC52xx GPT driver\n");
798
799 return 0;
800} 796}
801 797
802/* Make sure GPIOs and IRQs get set up before anyone tries to use them */ 798/* Make sure GPIOs and IRQs get set up before anyone tries to use them */
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index f4ac213c89c..6385d883cb8 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -436,8 +436,7 @@ void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req)
436} 436}
437EXPORT_SYMBOL(mpc52xx_lpbfifo_abort); 437EXPORT_SYMBOL(mpc52xx_lpbfifo_abort);
438 438
439static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op, 439static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op)
440 const struct of_device_id *match)
441{ 440{
442 struct resource res; 441 struct resource res;
443 int rc = -ENOMEM; 442 int rc = -ENOMEM;
@@ -536,7 +535,7 @@ static struct of_device_id mpc52xx_lpbfifo_match[] __devinitconst = {
536 {}, 535 {},
537}; 536};
538 537
539static struct of_platform_driver mpc52xx_lpbfifo_driver = { 538static struct platform_driver mpc52xx_lpbfifo_driver = {
540 .driver = { 539 .driver = {
541 .name = "mpc52xx-lpbfifo", 540 .name = "mpc52xx-lpbfifo",
542 .owner = THIS_MODULE, 541 .owner = THIS_MODULE,
@@ -551,14 +550,12 @@ static struct of_platform_driver mpc52xx_lpbfifo_driver = {
551 */ 550 */
552static int __init mpc52xx_lpbfifo_init(void) 551static int __init mpc52xx_lpbfifo_init(void)
553{ 552{
554 pr_debug("Registering LocalPlus bus FIFO driver\n"); 553 return platform_driver_register(&mpc52xx_lpbfifo_driver);
555 return of_register_platform_driver(&mpc52xx_lpbfifo_driver);
556} 554}
557module_init(mpc52xx_lpbfifo_init); 555module_init(mpc52xx_lpbfifo_init);
558 556
559static void __exit mpc52xx_lpbfifo_exit(void) 557static void __exit mpc52xx_lpbfifo_exit(void)
560{ 558{
561 pr_debug("Unregistering LocalPlus bus FIFO driver\n"); 559 platform_driver_unregister(&mpc52xx_lpbfifo_driver);
562 of_unregister_platform_driver(&mpc52xx_lpbfifo_driver);
563} 560}
564module_exit(mpc52xx_lpbfifo_exit); 561module_exit(mpc52xx_lpbfifo_exit);
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index 1565e0446dc..10ff526cd04 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -111,8 +111,7 @@ static struct mdiobb_ctrl ep8248e_mdio_ctrl = {
111 .ops = &ep8248e_mdio_ops, 111 .ops = &ep8248e_mdio_ops,
112}; 112};
113 113
114static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev, 114static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev)
115 const struct of_device_id *match)
116{ 115{
117 struct mii_bus *bus; 116 struct mii_bus *bus;
118 struct resource res; 117 struct resource res;
@@ -167,7 +166,7 @@ static const struct of_device_id ep8248e_mdio_match[] = {
167 {}, 166 {},
168}; 167};
169 168
170static struct of_platform_driver ep8248e_mdio_driver = { 169static struct platform_driver ep8248e_mdio_driver = {
171 .driver = { 170 .driver = {
172 .name = "ep8248e-mdio-bitbang", 171 .name = "ep8248e-mdio-bitbang",
173 .owner = THIS_MODULE, 172 .owner = THIS_MODULE,
@@ -308,7 +307,7 @@ static __initdata struct of_device_id of_bus_ids[] = {
308static int __init declare_of_platform_devices(void) 307static int __init declare_of_platform_devices(void)
309{ 308{
310 of_platform_bus_probe(NULL, of_bus_ids, NULL); 309 of_platform_bus_probe(NULL, of_bus_ids, NULL);
311 of_register_platform_driver(&ep8248e_mdio_driver); 310 platform_driver_register(&ep8248e_mdio_driver);
312 311
313 return 0; 312 return 0;
314} 313}
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index fd4f2f2f19e..188272934cf 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -318,14 +318,18 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
318 .end = mpc83xx_suspend_end, 318 .end = mpc83xx_suspend_end,
319}; 319};
320 320
321static int pmc_probe(struct platform_device *ofdev, 321static int pmc_probe(struct platform_device *ofdev)
322 const struct of_device_id *match)
323{ 322{
324 struct device_node *np = ofdev->dev.of_node; 323 struct device_node *np = ofdev->dev.of_node;
325 struct resource res; 324 struct resource res;
326 struct pmc_type *type = match->data; 325 struct pmc_type *type;
327 int ret = 0; 326 int ret = 0;
328 327
328 if (!ofdev->dev.of_match)
329 return -EINVAL;
330
331 type = ofdev->dev.of_match->data;
332
329 if (!of_device_is_available(np)) 333 if (!of_device_is_available(np))
330 return -ENODEV; 334 return -ENODEV;
331 335
@@ -422,7 +426,7 @@ static struct of_device_id pmc_match[] = {
422 {} 426 {}
423}; 427};
424 428
425static struct of_platform_driver pmc_driver = { 429static struct platform_driver pmc_driver = {
426 .driver = { 430 .driver = {
427 .name = "mpc83xx-pmc", 431 .name = "mpc83xx-pmc",
428 .owner = THIS_MODULE, 432 .owner = THIS_MODULE,
@@ -434,7 +438,7 @@ static struct of_platform_driver pmc_driver = {
434 438
435static int pmc_init(void) 439static int pmc_init(void)
436{ 440{
437 return of_register_platform_driver(&pmc_driver); 441 return platform_driver_register(&pmc_driver);
438} 442}
439 443
440module_init(pmc_init); 444module_init(pmc_init);
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index e3e379c6caa..c35099af340 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -328,7 +328,7 @@ static struct irq_host_ops msic_host_ops = {
328 .map = msic_host_map, 328 .map = msic_host_map,
329}; 329};
330 330
331static int axon_msi_shutdown(struct platform_device *device) 331static void axon_msi_shutdown(struct platform_device *device)
332{ 332{
333 struct axon_msic *msic = dev_get_drvdata(&device->dev); 333 struct axon_msic *msic = dev_get_drvdata(&device->dev);
334 u32 tmp; 334 u32 tmp;
@@ -338,12 +338,9 @@ static int axon_msi_shutdown(struct platform_device *device)
338 tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG); 338 tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG);
339 tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE; 339 tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE;
340 msic_dcr_write(msic, MSIC_CTRL_REG, tmp); 340 msic_dcr_write(msic, MSIC_CTRL_REG, tmp);
341
342 return 0;
343} 341}
344 342
345static int axon_msi_probe(struct platform_device *device, 343static int axon_msi_probe(struct platform_device *device)
346 const struct of_device_id *device_id)
347{ 344{
348 struct device_node *dn = device->dev.of_node; 345 struct device_node *dn = device->dev.of_node;
349 struct axon_msic *msic; 346 struct axon_msic *msic;
@@ -446,7 +443,7 @@ static const struct of_device_id axon_msi_device_id[] = {
446 {} 443 {}
447}; 444};
448 445
449static struct of_platform_driver axon_msi_driver = { 446static struct platform_driver axon_msi_driver = {
450 .probe = axon_msi_probe, 447 .probe = axon_msi_probe,
451 .shutdown = axon_msi_shutdown, 448 .shutdown = axon_msi_shutdown,
452 .driver = { 449 .driver = {
@@ -458,7 +455,7 @@ static struct of_platform_driver axon_msi_driver = {
458 455
459static int __init axon_msi_init(void) 456static int __init axon_msi_init(void)
460{ 457{
461 return of_register_platform_driver(&axon_msi_driver); 458 return platform_driver_register(&axon_msi_driver);
462} 459}
463subsys_initcall(axon_msi_init); 460subsys_initcall(axon_msi_init);
464 461
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index a5d907b5a4c..9886296e08d 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -216,8 +216,7 @@ static int gpio_mdio_reset(struct mii_bus *bus)
216} 216}
217 217
218 218
219static int __devinit gpio_mdio_probe(struct platform_device *ofdev, 219static int __devinit gpio_mdio_probe(struct platform_device *ofdev)
220 const struct of_device_id *match)
221{ 220{
222 struct device *dev = &ofdev->dev; 221 struct device *dev = &ofdev->dev;
223 struct device_node *np = ofdev->dev.of_node; 222 struct device_node *np = ofdev->dev.of_node;
@@ -299,7 +298,7 @@ static struct of_device_id gpio_mdio_match[] =
299}; 298};
300MODULE_DEVICE_TABLE(of, gpio_mdio_match); 299MODULE_DEVICE_TABLE(of, gpio_mdio_match);
301 300
302static struct of_platform_driver gpio_mdio_driver = 301static struct platform_driver gpio_mdio_driver =
303{ 302{
304 .probe = gpio_mdio_probe, 303 .probe = gpio_mdio_probe,
305 .remove = gpio_mdio_remove, 304 .remove = gpio_mdio_remove,
@@ -326,13 +325,13 @@ int gpio_mdio_init(void)
326 if (!gpio_regs) 325 if (!gpio_regs)
327 return -ENODEV; 326 return -ENODEV;
328 327
329 return of_register_platform_driver(&gpio_mdio_driver); 328 return platform_driver_register(&gpio_mdio_driver);
330} 329}
331module_init(gpio_mdio_init); 330module_init(gpio_mdio_init);
332 331
333void gpio_mdio_exit(void) 332void gpio_mdio_exit(void)
334{ 333{
335 of_unregister_platform_driver(&gpio_mdio_driver); 334 platform_driver_unregister(&gpio_mdio_driver);
336 if (gpio_regs) 335 if (gpio_regs)
337 iounmap(gpio_regs); 336 iounmap(gpio_regs);
338} 337}
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 5fcc92a12d3..3bf4488aaec 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -149,7 +149,7 @@ struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn)
149 if (dn->child) 149 if (dn->child)
150 eeh_add_device_tree_early(dn); 150 eeh_add_device_tree_early(dn);
151 151
152 pcibios_scan_phb(phb, dn); 152 pcibios_scan_phb(phb);
153 pcibios_finish_adding_to_bus(phb->bus); 153 pcibios_finish_adding_to_bus(phb->bus);
154 154
155 return phb; 155 return phb;
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 2659a60bd7b..27402c7d309 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -172,10 +172,9 @@ static const struct block_device_operations axon_ram_devops = {
172 172
173/** 173/**
174 * axon_ram_probe - probe() method for platform driver 174 * axon_ram_probe - probe() method for platform driver
175 * @device, @device_id: see of_platform_driver method 175 * @device: see platform_driver method
176 */ 176 */
177static int axon_ram_probe(struct platform_device *device, 177static int axon_ram_probe(struct platform_device *device)
178 const struct of_device_id *device_id)
179{ 178{
180 static int axon_ram_bank_id = -1; 179 static int axon_ram_bank_id = -1;
181 struct axon_ram_bank *bank; 180 struct axon_ram_bank *bank;
@@ -326,7 +325,7 @@ static struct of_device_id axon_ram_device_id[] = {
326 {} 325 {}
327}; 326};
328 327
329static struct of_platform_driver axon_ram_driver = { 328static struct platform_driver axon_ram_driver = {
330 .probe = axon_ram_probe, 329 .probe = axon_ram_probe,
331 .remove = axon_ram_remove, 330 .remove = axon_ram_remove,
332 .driver = { 331 .driver = {
@@ -350,7 +349,7 @@ axon_ram_init(void)
350 } 349 }
351 azfs_minor = 0; 350 azfs_minor = 0;
352 351
353 return of_register_platform_driver(&axon_ram_driver); 352 return platform_driver_register(&axon_ram_driver);
354} 353}
355 354
356/** 355/**
@@ -359,7 +358,7 @@ axon_ram_init(void)
359static void __exit 358static void __exit
360axon_ram_exit(void) 359axon_ram_exit(void)
361{ 360{
362 of_unregister_platform_driver(&axon_ram_driver); 361 platform_driver_unregister(&axon_ram_driver);
363 unregister_blkdev(azfs_major, AXON_RAM_DEVICE_NAME); 362 unregister_blkdev(azfs_major, AXON_RAM_DEVICE_NAME);
364} 363}
365 364
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
index 65025611506..b3fbb271be8 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm.c
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c
@@ -365,8 +365,7 @@ bcom_engine_cleanup(void)
365/* OF platform driver */ 365/* OF platform driver */
366/* ======================================================================== */ 366/* ======================================================================== */
367 367
368static int __devinit mpc52xx_bcom_probe(struct platform_device *op, 368static int __devinit mpc52xx_bcom_probe(struct platform_device *op)
369 const struct of_device_id *match)
370{ 369{
371 struct device_node *ofn_sram; 370 struct device_node *ofn_sram;
372 struct resource res_bcom; 371 struct resource res_bcom;
@@ -492,7 +491,7 @@ static struct of_device_id mpc52xx_bcom_of_match[] = {
492MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match); 491MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match);
493 492
494 493
495static struct of_platform_driver mpc52xx_bcom_of_platform_driver = { 494static struct platform_driver mpc52xx_bcom_of_platform_driver = {
496 .probe = mpc52xx_bcom_probe, 495 .probe = mpc52xx_bcom_probe,
497 .remove = mpc52xx_bcom_remove, 496 .remove = mpc52xx_bcom_remove,
498 .driver = { 497 .driver = {
@@ -510,13 +509,13 @@ static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
510static int __init 509static int __init
511mpc52xx_bcom_init(void) 510mpc52xx_bcom_init(void)
512{ 511{
513 return of_register_platform_driver(&mpc52xx_bcom_of_platform_driver); 512 return platform_driver_register(&mpc52xx_bcom_of_platform_driver);
514} 513}
515 514
516static void __exit 515static void __exit
517mpc52xx_bcom_exit(void) 516mpc52xx_bcom_exit(void)
518{ 517{
519 of_unregister_platform_driver(&mpc52xx_bcom_of_platform_driver); 518 platform_driver_unregister(&mpc52xx_bcom_of_platform_driver);
520} 519}
521 520
522/* If we're not a module, we must make sure everything is setup before */ 521/* If we're not a module, we must make sure everything is setup before */
diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
index cc8d6556d79..2b9f0c92532 100644
--- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
+++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
@@ -71,8 +71,7 @@ static int __init get_offset_from_cmdline(char *str)
71__setup("cache-sram-size=", get_size_from_cmdline); 71__setup("cache-sram-size=", get_size_from_cmdline);
72__setup("cache-sram-offset=", get_offset_from_cmdline); 72__setup("cache-sram-offset=", get_offset_from_cmdline);
73 73
74static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev, 74static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev)
75 const struct of_device_id *match)
76{ 75{
77 long rval; 76 long rval;
78 unsigned int rem; 77 unsigned int rem;
@@ -204,7 +203,7 @@ static struct of_device_id mpc85xx_l2ctlr_of_match[] = {
204 {}, 203 {},
205}; 204};
206 205
207static struct of_platform_driver mpc85xx_l2ctlr_of_platform_driver = { 206static struct platform_driver mpc85xx_l2ctlr_of_platform_driver = {
208 .driver = { 207 .driver = {
209 .name = "fsl-l2ctlr", 208 .name = "fsl-l2ctlr",
210 .owner = THIS_MODULE, 209 .owner = THIS_MODULE,
@@ -216,12 +215,12 @@ static struct of_platform_driver mpc85xx_l2ctlr_of_platform_driver = {
216 215
217static __init int mpc85xx_l2ctlr_of_init(void) 216static __init int mpc85xx_l2ctlr_of_init(void)
218{ 217{
219 return of_register_platform_driver(&mpc85xx_l2ctlr_of_platform_driver); 218 return platform_driver_register(&mpc85xx_l2ctlr_of_platform_driver);
220} 219}
221 220
222static void __exit mpc85xx_l2ctlr_of_exit(void) 221static void __exit mpc85xx_l2ctlr_of_exit(void)
223{ 222{
224 of_unregister_platform_driver(&mpc85xx_l2ctlr_of_platform_driver); 223 platform_driver_unregister(&mpc85xx_l2ctlr_of_platform_driver);
225} 224}
226 225
227subsys_initcall(mpc85xx_l2ctlr_of_init); 226subsys_initcall(mpc85xx_l2ctlr_of_init);
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 108d76fa8f1..ee6a8a52ac7 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -273,8 +273,7 @@ static int fsl_of_msi_remove(struct platform_device *ofdev)
273 return 0; 273 return 0;
274} 274}
275 275
276static int __devinit fsl_of_msi_probe(struct platform_device *dev, 276static int __devinit fsl_of_msi_probe(struct platform_device *dev)
277 const struct of_device_id *match)
278{ 277{
279 struct fsl_msi *msi; 278 struct fsl_msi *msi;
280 struct resource res; 279 struct resource res;
@@ -282,11 +281,15 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev,
282 int rc; 281 int rc;
283 int virt_msir; 282 int virt_msir;
284 const u32 *p; 283 const u32 *p;
285 struct fsl_msi_feature *features = match->data; 284 struct fsl_msi_feature *features;
286 struct fsl_msi_cascade_data *cascade_data = NULL; 285 struct fsl_msi_cascade_data *cascade_data = NULL;
287 int len; 286 int len;
288 u32 offset; 287 u32 offset;
289 288
289 if (!dev->dev.of_match)
290 return -EINVAL;
291 features = dev->dev.of_match->data;
292
290 printk(KERN_DEBUG "Setting up Freescale MSI support\n"); 293 printk(KERN_DEBUG "Setting up Freescale MSI support\n");
291 294
292 msi = kzalloc(sizeof(struct fsl_msi), GFP_KERNEL); 295 msi = kzalloc(sizeof(struct fsl_msi), GFP_KERNEL);
@@ -411,7 +414,7 @@ static const struct of_device_id fsl_of_msi_ids[] = {
411 {} 414 {}
412}; 415};
413 416
414static struct of_platform_driver fsl_of_msi_driver = { 417static struct platform_driver fsl_of_msi_driver = {
415 .driver = { 418 .driver = {
416 .name = "fsl-msi", 419 .name = "fsl-msi",
417 .owner = THIS_MODULE, 420 .owner = THIS_MODULE,
@@ -423,7 +426,7 @@ static struct of_platform_driver fsl_of_msi_driver = {
423 426
424static __init int fsl_of_msi_init(void) 427static __init int fsl_of_msi_init(void)
425{ 428{
426 return of_register_platform_driver(&fsl_of_msi_driver); 429 return platform_driver_register(&fsl_of_msi_driver);
427} 430}
428 431
429subsys_initcall(fsl_of_msi_init); 432subsys_initcall(fsl_of_msi_init);
diff --git a/arch/powerpc/sysdev/fsl_pmc.c b/arch/powerpc/sysdev/fsl_pmc.c
index e9381bfefb2..f122e8961d3 100644
--- a/arch/powerpc/sysdev/fsl_pmc.c
+++ b/arch/powerpc/sysdev/fsl_pmc.c
@@ -58,8 +58,7 @@ static const struct platform_suspend_ops pmc_suspend_ops = {
58 .enter = pmc_suspend_enter, 58 .enter = pmc_suspend_enter,
59}; 59};
60 60
61static int pmc_probe(struct platform_device *ofdev, 61static int pmc_probe(struct platform_device *ofdev)
62 const struct of_device_id *id)
63{ 62{
64 pmc_regs = of_iomap(ofdev->dev.of_node, 0); 63 pmc_regs = of_iomap(ofdev->dev.of_node, 0);
65 if (!pmc_regs) 64 if (!pmc_regs)
@@ -76,7 +75,7 @@ static const struct of_device_id pmc_ids[] = {
76 { }, 75 { },
77}; 76};
78 77
79static struct of_platform_driver pmc_driver = { 78static struct platform_driver pmc_driver = {
80 .driver = { 79 .driver = {
81 .name = "fsl-pmc", 80 .name = "fsl-pmc",
82 .owner = THIS_MODULE, 81 .owner = THIS_MODULE,
@@ -87,6 +86,6 @@ static struct of_platform_driver pmc_driver = {
87 86
88static int __init pmc_init(void) 87static int __init pmc_init(void)
89{ 88{
90 return of_register_platform_driver(&pmc_driver); 89 return platform_driver_register(&pmc_driver);
91} 90}
92device_initcall(pmc_init); 91device_initcall(pmc_init);
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 8c6cab01327..3eff2c3a9ad 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1570,8 +1570,7 @@ err_ops:
1570 1570
1571/* The probe function for RapidIO peer-to-peer network. 1571/* The probe function for RapidIO peer-to-peer network.
1572 */ 1572 */
1573static int __devinit fsl_of_rio_rpn_probe(struct platform_device *dev, 1573static int __devinit fsl_of_rio_rpn_probe(struct platform_device *dev)
1574 const struct of_device_id *match)
1575{ 1574{
1576 int rc; 1575 int rc;
1577 printk(KERN_INFO "Setting up RapidIO peer-to-peer network %s\n", 1576 printk(KERN_INFO "Setting up RapidIO peer-to-peer network %s\n",
@@ -1594,7 +1593,7 @@ static const struct of_device_id fsl_of_rio_rpn_ids[] = {
1594 {}, 1593 {},
1595}; 1594};
1596 1595
1597static struct of_platform_driver fsl_of_rio_rpn_driver = { 1596static struct platform_driver fsl_of_rio_rpn_driver = {
1598 .driver = { 1597 .driver = {
1599 .name = "fsl-of-rio", 1598 .name = "fsl-of-rio",
1600 .owner = THIS_MODULE, 1599 .owner = THIS_MODULE,
@@ -1605,7 +1604,7 @@ static struct of_platform_driver fsl_of_rio_rpn_driver = {
1605 1604
1606static __init int fsl_of_rio_rpn_init(void) 1605static __init int fsl_of_rio_rpn_init(void)
1607{ 1606{
1608 return of_register_platform_driver(&fsl_of_rio_rpn_driver); 1607 return platform_driver_register(&fsl_of_rio_rpn_driver);
1609} 1608}
1610 1609
1611subsys_initcall(fsl_of_rio_rpn_init); 1610subsys_initcall(fsl_of_rio_rpn_init);
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c
index 4260f368db5..8ce4fc3d982 100644
--- a/arch/powerpc/sysdev/pmi.c
+++ b/arch/powerpc/sysdev/pmi.c
@@ -121,8 +121,7 @@ static void pmi_notify_handlers(struct work_struct *work)
121 spin_unlock(&data->handler_spinlock); 121 spin_unlock(&data->handler_spinlock);
122} 122}
123 123
124static int pmi_of_probe(struct platform_device *dev, 124static int pmi_of_probe(struct platform_device *dev)
125 const struct of_device_id *match)
126{ 125{
127 struct device_node *np = dev->dev.of_node; 126 struct device_node *np = dev->dev.of_node;
128 int rc; 127 int rc;
@@ -205,7 +204,7 @@ static int pmi_of_remove(struct platform_device *dev)
205 return 0; 204 return 0;
206} 205}
207 206
208static struct of_platform_driver pmi_of_platform_driver = { 207static struct platform_driver pmi_of_platform_driver = {
209 .probe = pmi_of_probe, 208 .probe = pmi_of_probe,
210 .remove = pmi_of_remove, 209 .remove = pmi_of_remove,
211 .driver = { 210 .driver = {
@@ -217,13 +216,13 @@ static struct of_platform_driver pmi_of_platform_driver = {
217 216
218static int __init pmi_module_init(void) 217static int __init pmi_module_init(void)
219{ 218{
220 return of_register_platform_driver(&pmi_of_platform_driver); 219 return platform_driver_register(&pmi_of_platform_driver);
221} 220}
222module_init(pmi_module_init); 221module_init(pmi_module_init);
223 222
224static void __exit pmi_module_exit(void) 223static void __exit pmi_module_exit(void)
225{ 224{
226 of_unregister_platform_driver(&pmi_of_platform_driver); 225 platform_driver_unregister(&pmi_of_platform_driver);
227} 226}
228module_exit(pmi_module_exit); 227module_exit(pmi_module_exit);
229 228
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 90020de4dcf..904c6cbaf45 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -659,8 +659,7 @@ static int qe_resume(struct platform_device *ofdev)
659 return 0; 659 return 0;
660} 660}
661 661
662static int qe_probe(struct platform_device *ofdev, 662static int qe_probe(struct platform_device *ofdev)
663 const struct of_device_id *id)
664{ 663{
665 return 0; 664 return 0;
666} 665}
@@ -670,7 +669,7 @@ static const struct of_device_id qe_ids[] = {
670 { }, 669 { },
671}; 670};
672 671
673static struct of_platform_driver qe_driver = { 672static struct platform_driver qe_driver = {
674 .driver = { 673 .driver = {
675 .name = "fsl-qe", 674 .name = "fsl-qe",
676 .owner = THIS_MODULE, 675 .owner = THIS_MODULE,
@@ -682,7 +681,7 @@ static struct of_platform_driver qe_driver = {
682 681
683static int __init qe_drv_init(void) 682static int __init qe_drv_init(void)
684{ 683{
685 return of_register_platform_driver(&qe_driver); 684 return platform_driver_register(&qe_driver);
686} 685}
687device_initcall(qe_drv_init); 686device_initcall(qe_drv_init);
688#endif /* defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) */ 687#endif /* defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) */