aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-08-19 06:48:09 -0400
committerIngo Molnar <mingo@elte.hu>2010-08-19 06:48:09 -0400
commitc8710ad38900153af7a3e6762e99c062cfa46443 (patch)
treea0c0632274c4eb72f51e99a5861f71cffe65ea60 /arch/sparc/kernel
parent6016ee13db518ab1cd0cbf43fc2ad5712021e338 (diff)
parent86397dc3ccfc0e17b7550d05eaf15fe91f6498dd (diff)
Merge branch 'tip/perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r--arch/sparc/kernel/apc.c6
-rw-r--r--arch/sparc/kernel/auxio_64.c5
-rw-r--r--arch/sparc/kernel/central.c8
-rw-r--r--arch/sparc/kernel/chmc.c16
-rw-r--r--arch/sparc/kernel/helpers.S75
-rw-r--r--arch/sparc/kernel/ioport.c2
-rw-r--r--arch/sparc/kernel/of_device_32.c63
-rw-r--r--arch/sparc/kernel/of_device_64.c61
-rw-r--r--arch/sparc/kernel/of_device_common.c35
-rw-r--r--arch/sparc/kernel/pci.c6
-rw-r--r--arch/sparc/kernel/pci_fire.c6
-rw-r--r--arch/sparc/kernel/pci_impl.h2
-rw-r--r--arch/sparc/kernel/pci_psycho.c16
-rw-r--r--arch/sparc/kernel/pci_sabre.c16
-rw-r--r--arch/sparc/kernel/pci_schizo.c32
-rw-r--r--arch/sparc/kernel/pci_sun4v.c6
-rw-r--r--arch/sparc/kernel/pmc.c4
-rw-r--r--arch/sparc/kernel/power.c6
-rw-r--r--arch/sparc/kernel/prom.h8
-rw-r--r--arch/sparc/kernel/prom_64.c6
-rw-r--r--arch/sparc/kernel/prom_common.c2
-rw-r--r--arch/sparc/kernel/prom_irqtrans.c2
-rw-r--r--arch/sparc/kernel/psycho_common.c2
-rw-r--r--arch/sparc/kernel/psycho_common.h2
-rw-r--r--arch/sparc/kernel/sbus.c16
-rw-r--r--arch/sparc/kernel/sys_sparc32.c7
-rw-r--r--arch/sparc/kernel/time_32.c4
-rw-r--r--arch/sparc/kernel/time_64.c12
28 files changed, 146 insertions, 280 deletions
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index b27476caa13..2c0046ecc71 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -68,7 +68,7 @@ static void apc_swift_idle(void)
68#endif 68#endif
69} 69}
70 70
71static inline void apc_free(struct of_device *op) 71static inline void apc_free(struct platform_device *op)
72{ 72{
73 of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0])); 73 of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0]));
74} 74}
@@ -136,7 +136,7 @@ static const struct file_operations apc_fops = {
136 136
137static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops }; 137static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };
138 138
139static int __devinit apc_probe(struct of_device *op, 139static int __devinit apc_probe(struct platform_device *op,
140 const struct of_device_id *match) 140 const struct of_device_id *match)
141{ 141{
142 int err; 142 int err;
@@ -184,7 +184,7 @@ static struct of_platform_driver apc_driver = {
184 184
185static int __init apc_init(void) 185static int __init apc_init(void)
186{ 186{
187 return of_register_driver(&apc_driver, &of_bus_type); 187 return of_register_platform_driver(&apc_driver);
188} 188}
189 189
190/* This driver is not critical to the boot process 190/* This driver is not critical to the boot process
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index ddc84128b3c..3efd3c5af6a 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -102,7 +102,8 @@ static struct of_device_id __initdata auxio_match[] = {
102 102
103MODULE_DEVICE_TABLE(of, auxio_match); 103MODULE_DEVICE_TABLE(of, auxio_match);
104 104
105static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match) 105static int __devinit auxio_probe(struct platform_device *dev,
106 const struct of_device_id *match)
106{ 107{
107 struct device_node *dp = dev->dev.of_node; 108 struct device_node *dp = dev->dev.of_node;
108 unsigned long size; 109 unsigned long size;
@@ -142,7 +143,7 @@ static struct of_platform_driver auxio_driver = {
142 143
143static int __init auxio_init(void) 144static int __init auxio_init(void)
144{ 145{
145 return of_register_driver(&auxio_driver, &of_platform_bus_type); 146 return of_register_platform_driver(&auxio_driver);
146} 147}
147 148
148/* Must be after subsys_initcall() so that busses are probed. Must 149/* Must be after subsys_initcall() so that busses are probed. Must
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index 434335f6582..cfa2624c533 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -59,7 +59,7 @@ static int __devinit clock_board_calc_nslots(struct clock_board *p)
59 } 59 }
60} 60}
61 61
62static int __devinit clock_board_probe(struct of_device *op, 62static int __devinit clock_board_probe(struct platform_device *op,
63 const struct of_device_id *match) 63 const struct of_device_id *match)
64{ 64{
65 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL); 65 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -157,7 +157,7 @@ static struct of_platform_driver clock_board_driver = {
157 }, 157 },
158}; 158};
159 159
160static int __devinit fhc_probe(struct of_device *op, 160static int __devinit fhc_probe(struct platform_device *op,
161 const struct of_device_id *match) 161 const struct of_device_id *match)
162{ 162{
163 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL); 163 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -265,8 +265,8 @@ static struct of_platform_driver fhc_driver = {
265 265
266static int __init sunfire_init(void) 266static int __init sunfire_init(void)
267{ 267{
268 (void) of_register_driver(&fhc_driver, &of_platform_bus_type); 268 (void) of_register_platform_driver(&fhc_driver);
269 (void) of_register_driver(&clock_board_driver, &of_platform_bus_type); 269 (void) of_register_platform_driver(&clock_board_driver);
270 return 0; 270 return 0;
271} 271}
272 272
diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 870cb65b3f2..08c466ebb32 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -392,7 +392,7 @@ static void __devinit jbusmc_construct_dimm_groups(struct jbusmc *p,
392 } 392 }
393} 393}
394 394
395static int __devinit jbusmc_probe(struct of_device *op, 395static int __devinit jbusmc_probe(struct platform_device *op,
396 const struct of_device_id *match) 396 const struct of_device_id *match)
397{ 397{
398 const struct linux_prom64_registers *mem_regs; 398 const struct linux_prom64_registers *mem_regs;
@@ -690,7 +690,7 @@ static void chmc_fetch_decode_regs(struct chmc *p)
690 chmc_read_mcreg(p, CHMCTRL_DECODE4)); 690 chmc_read_mcreg(p, CHMCTRL_DECODE4));
691} 691}
692 692
693static int __devinit chmc_probe(struct of_device *op, 693static int __devinit chmc_probe(struct platform_device *op,
694 const struct of_device_id *match) 694 const struct of_device_id *match)
695{ 695{
696 struct device_node *dp = op->dev.of_node; 696 struct device_node *dp = op->dev.of_node;
@@ -765,7 +765,7 @@ out_free:
765 goto out; 765 goto out;
766} 766}
767 767
768static int __devinit us3mc_probe(struct of_device *op, 768static int __devinit us3mc_probe(struct platform_device *op,
769 const struct of_device_id *match) 769 const struct of_device_id *match)
770{ 770{
771 if (mc_type == MC_TYPE_SAFARI) 771 if (mc_type == MC_TYPE_SAFARI)
@@ -775,21 +775,21 @@ static int __devinit us3mc_probe(struct of_device *op,
775 return -ENODEV; 775 return -ENODEV;
776} 776}
777 777
778static void __devexit chmc_destroy(struct of_device *op, struct chmc *p) 778static void __devexit chmc_destroy(struct platform_device *op, struct chmc *p)
779{ 779{
780 list_del(&p->list); 780 list_del(&p->list);
781 of_iounmap(&op->resource[0], p->regs, 0x48); 781 of_iounmap(&op->resource[0], p->regs, 0x48);
782 kfree(p); 782 kfree(p);
783} 783}
784 784
785static void __devexit jbusmc_destroy(struct of_device *op, struct jbusmc *p) 785static void __devexit jbusmc_destroy(struct platform_device *op, struct jbusmc *p)
786{ 786{
787 mc_list_del(&p->list); 787 mc_list_del(&p->list);
788 of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE); 788 of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE);
789 kfree(p); 789 kfree(p);
790} 790}
791 791
792static int __devexit us3mc_remove(struct of_device *op) 792static int __devexit us3mc_remove(struct platform_device *op)
793{ 793{
794 void *p = dev_get_drvdata(&op->dev); 794 void *p = dev_get_drvdata(&op->dev);
795 795
@@ -848,7 +848,7 @@ static int __init us3mc_init(void)
848 ret = register_dimm_printer(us3mc_dimm_printer); 848 ret = register_dimm_printer(us3mc_dimm_printer);
849 849
850 if (!ret) { 850 if (!ret) {
851 ret = of_register_driver(&us3mc_driver, &of_bus_type); 851 ret = of_register_platform_driver(&us3mc_driver);
852 if (ret) 852 if (ret)
853 unregister_dimm_printer(us3mc_dimm_printer); 853 unregister_dimm_printer(us3mc_dimm_printer);
854 } 854 }
@@ -859,7 +859,7 @@ static void __exit us3mc_cleanup(void)
859{ 859{
860 if (us3mc_platform()) { 860 if (us3mc_platform()) {
861 unregister_dimm_printer(us3mc_dimm_printer); 861 unregister_dimm_printer(us3mc_dimm_printer);
862 of_unregister_driver(&us3mc_driver); 862 of_unregister_platform_driver(&us3mc_driver);
863 } 863 }
864} 864}
865 865
diff --git a/arch/sparc/kernel/helpers.S b/arch/sparc/kernel/helpers.S
index 682fee06a16..314dd0c9fc5 100644
--- a/arch/sparc/kernel/helpers.S
+++ b/arch/sparc/kernel/helpers.S
@@ -46,81 +46,6 @@ stack_trace_flush:
46 nop 46 nop
47 .size stack_trace_flush,.-stack_trace_flush 47 .size stack_trace_flush,.-stack_trace_flush
48 48
49#ifdef CONFIG_PERF_EVENTS
50 .globl __perf_arch_fetch_caller_regs
51 .type __perf_arch_fetch_caller_regs,#function
52__perf_arch_fetch_caller_regs:
53 /* We always read the %pstate into %o5 since we will use
54 * that to construct a fake %tstate to store into the regs.
55 */
56 rdpr %pstate, %o5
57 brz,pn %o2, 50f
58 mov %o2, %g7
59
60 /* Turn off interrupts while we walk around the register
61 * window by hand.
62 */
63 wrpr %o5, PSTATE_IE, %pstate
64
65 /* The %canrestore tells us how many register windows are
66 * still live in the chip above us, past that we have to
67 * walk the frame as saved on the stack. We stash away
68 * the %cwp in %g1 so we can return back to the original
69 * register window.
70 */
71 rdpr %cwp, %g1
72 rdpr %canrestore, %g2
73 sub %g1, 1, %g3
74
75 /* We have the skip count in %g7, if it hits zero then
76 * %fp/%i7 are the registers we need. Otherwise if our
77 * %canrestore count maintained in %g2 hits zero we have
78 * to start traversing the stack.
79 */
8010: brz,pn %g2, 4f
81 sub %g2, 1, %g2
82 wrpr %g3, %cwp
83 subcc %g7, 1, %g7
84 bne,pt %xcc, 10b
85 sub %g3, 1, %g3
86
87 /* We found the values we need in the cpu's register
88 * windows.
89 */
90 mov %fp, %g3
91 ba,pt %xcc, 3f
92 mov %i7, %g2
93
9450: mov %fp, %g3
95 ba,pt %xcc, 2f
96 mov %i7, %g2
97
98 /* We hit the end of the valid register windows in the
99 * cpu, start traversing the stack frame.
100 */
1014: mov %fp, %g3
102
10320: ldx [%g3 + STACK_BIAS + RW_V9_I7], %g2
104 subcc %g7, 1, %g7
105 bne,pn %xcc, 20b
106 ldx [%g3 + STACK_BIAS + RW_V9_I6], %g3
107
108 /* Restore the current register window position and
109 * re-enable interrupts.
110 */
1113: wrpr %g1, %cwp
112 wrpr %o5, %pstate
113
1142: stx %g3, [%o0 + PT_V9_FP]
115 sllx %o5, 8, %o5
116 stx %o5, [%o0 + PT_V9_TSTATE]
117 stx %g2, [%o0 + PT_V9_TPC]
118 add %g2, 4, %g2
119 retl
120 stx %g2, [%o0 + PT_V9_TNPC]
121 .size perf_arch_fetch_caller_regs,.-perf_arch_fetch_caller_regs
122#endif /* CONFIG_PERF_EVENTS */
123
124#ifdef CONFIG_SMP 49#ifdef CONFIG_SMP
125 .globl hard_smp_processor_id 50 .globl hard_smp_processor_id
126 .type hard_smp_processor_id,#function 51 .type hard_smp_processor_id,#function
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 703e4aa9bc3..41f7e4e0f72 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -253,7 +253,7 @@ EXPORT_SYMBOL(sbus_set_sbus64);
253static void *sbus_alloc_coherent(struct device *dev, size_t len, 253static void *sbus_alloc_coherent(struct device *dev, size_t len,
254 dma_addr_t *dma_addrp, gfp_t gfp) 254 dma_addr_t *dma_addrp, gfp_t gfp)
255{ 255{
256 struct of_device *op = to_of_device(dev); 256 struct platform_device *op = to_platform_device(dev);
257 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK; 257 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
258 unsigned long va; 258 unsigned long va;
259 struct resource *res; 259 struct resource *res;
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 47e63f1e719..2d055a1e9cc 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -241,10 +241,10 @@ static int __init use_1to1_mapping(struct device_node *pp)
241 241
242static int of_resource_verbose; 242static int of_resource_verbose;
243 243
244static void __init build_device_resources(struct of_device *op, 244static void __init build_device_resources(struct platform_device *op,
245 struct device *parent) 245 struct device *parent)
246{ 246{
247 struct of_device *p_op; 247 struct platform_device *p_op;
248 struct of_bus *bus; 248 struct of_bus *bus;
249 int na, ns; 249 int na, ns;
250 int index, num_reg; 250 int index, num_reg;
@@ -253,7 +253,7 @@ static void __init build_device_resources(struct of_device *op,
253 if (!parent) 253 if (!parent)
254 return; 254 return;
255 255
256 p_op = to_of_device(parent); 256 p_op = to_platform_device(parent);
257 bus = of_match_bus(p_op->dev.of_node); 257 bus = of_match_bus(p_op->dev.of_node);
258 bus->count_cells(op->dev.of_node, &na, &ns); 258 bus->count_cells(op->dev.of_node, &na, &ns);
259 259
@@ -267,6 +267,8 @@ static void __init build_device_resources(struct of_device *op,
267 /* Conver to num-entries. */ 267 /* Conver to num-entries. */
268 num_reg /= na + ns; 268 num_reg /= na + ns;
269 269
270 op->resource = op->archdata.resource;
271 op->num_resources = num_reg;
270 for (index = 0; index < num_reg; index++) { 272 for (index = 0; index < num_reg; index++) {
271 struct resource *r = &op->resource[index]; 273 struct resource *r = &op->resource[index];
272 u32 addr[OF_MAX_ADDR_CELLS]; 274 u32 addr[OF_MAX_ADDR_CELLS];
@@ -333,10 +335,10 @@ static void __init build_device_resources(struct of_device *op,
333 } 335 }
334} 336}
335 337
336static struct of_device * __init scan_one_device(struct device_node *dp, 338static struct platform_device * __init scan_one_device(struct device_node *dp,
337 struct device *parent) 339 struct device *parent)
338{ 340{
339 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 341 struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
340 const struct linux_prom_irqs *intr; 342 const struct linux_prom_irqs *intr;
341 struct dev_archdata *sd; 343 struct dev_archdata *sd;
342 int len, i; 344 int len, i;
@@ -349,27 +351,21 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
349 351
350 op->dev.of_node = dp; 352 op->dev.of_node = dp;
351 353
352 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
353 (25*1000*1000));
354 op->portid = of_getintprop_default(dp, "upa-portid", -1);
355 if (op->portid == -1)
356 op->portid = of_getintprop_default(dp, "portid", -1);
357
358 intr = of_get_property(dp, "intr", &len); 354 intr = of_get_property(dp, "intr", &len);
359 if (intr) { 355 if (intr) {
360 op->num_irqs = len / sizeof(struct linux_prom_irqs); 356 op->archdata.num_irqs = len / sizeof(struct linux_prom_irqs);
361 for (i = 0; i < op->num_irqs; i++) 357 for (i = 0; i < op->archdata.num_irqs; i++)
362 op->irqs[i] = intr[i].pri; 358 op->archdata.irqs[i] = intr[i].pri;
363 } else { 359 } else {
364 const unsigned int *irq = 360 const unsigned int *irq =
365 of_get_property(dp, "interrupts", &len); 361 of_get_property(dp, "interrupts", &len);
366 362
367 if (irq) { 363 if (irq) {
368 op->num_irqs = len / sizeof(unsigned int); 364 op->archdata.num_irqs = len / sizeof(unsigned int);
369 for (i = 0; i < op->num_irqs; i++) 365 for (i = 0; i < op->archdata.num_irqs; i++)
370 op->irqs[i] = irq[i]; 366 op->archdata.irqs[i] = irq[i];
371 } else { 367 } else {
372 op->num_irqs = 0; 368 op->archdata.num_irqs = 0;
373 } 369 }
374 } 370 }
375 if (sparc_cpu_model == sun4d) { 371 if (sparc_cpu_model == sun4d) {
@@ -411,8 +407,8 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
411 goto build_resources; 407 goto build_resources;
412 } 408 }
413 409
414 for (i = 0; i < op->num_irqs; i++) { 410 for (i = 0; i < op->archdata.num_irqs; i++) {
415 int this_irq = op->irqs[i]; 411 int this_irq = op->archdata.irqs[i];
416 int sbusl = pil_to_sbus[this_irq]; 412 int sbusl = pil_to_sbus[this_irq];
417 413
418 if (sbusl) 414 if (sbusl)
@@ -420,7 +416,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
420 (sbusl << 2) + 416 (sbusl << 2) +
421 slot); 417 slot);
422 418
423 op->irqs[i] = this_irq; 419 op->archdata.irqs[i] = this_irq;
424 } 420 }
425 } 421 }
426 422
@@ -428,7 +424,7 @@ build_resources:
428 build_device_resources(op, parent); 424 build_device_resources(op, parent);
429 425
430 op->dev.parent = parent; 426 op->dev.parent = parent;
431 op->dev.bus = &of_platform_bus_type; 427 op->dev.bus = &platform_bus_type;
432 if (!parent) 428 if (!parent)
433 dev_set_name(&op->dev, "root"); 429 dev_set_name(&op->dev, "root");
434 else 430 else
@@ -447,7 +443,7 @@ build_resources:
447static void __init scan_tree(struct device_node *dp, struct device *parent) 443static void __init scan_tree(struct device_node *dp, struct device *parent)
448{ 444{
449 while (dp) { 445 while (dp) {
450 struct of_device *op = scan_one_device(dp, parent); 446 struct platform_device *op = scan_one_device(dp, parent);
451 447
452 if (op) 448 if (op)
453 scan_tree(dp->child, &op->dev); 449 scan_tree(dp->child, &op->dev);
@@ -456,30 +452,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent)
456 } 452 }
457} 453}
458 454
459static void __init scan_of_devices(void) 455static int __init scan_of_devices(void)
460{ 456{
461 struct device_node *root = of_find_node_by_path("/"); 457 struct device_node *root = of_find_node_by_path("/");
462 struct of_device *parent; 458 struct platform_device *parent;
463 459
464 parent = scan_one_device(root, NULL); 460 parent = scan_one_device(root, NULL);
465 if (!parent) 461 if (!parent)
466 return; 462 return 0;
467 463
468 scan_tree(root->child, &parent->dev); 464 scan_tree(root->child, &parent->dev);
465 return 0;
469} 466}
470 467postcore_initcall(scan_of_devices);
471static int __init of_bus_driver_init(void)
472{
473 int err;
474
475 err = of_bus_type_init(&of_platform_bus_type, "of");
476 if (!err)
477 scan_of_devices();
478
479 return err;
480}
481
482postcore_initcall(of_bus_driver_init);
483 468
484static int __init of_debug(char *str) 469static int __init of_debug(char *str)
485{ 470{
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 1dae8079f72..63cd4e5d47c 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -310,10 +310,10 @@ static int __init use_1to1_mapping(struct device_node *pp)
310 310
311static int of_resource_verbose; 311static int of_resource_verbose;
312 312
313static void __init build_device_resources(struct of_device *op, 313static void __init build_device_resources(struct platform_device *op,
314 struct device *parent) 314 struct device *parent)
315{ 315{
316 struct of_device *p_op; 316 struct platform_device *p_op;
317 struct of_bus *bus; 317 struct of_bus *bus;
318 int na, ns; 318 int na, ns;
319 int index, num_reg; 319 int index, num_reg;
@@ -322,7 +322,7 @@ static void __init build_device_resources(struct of_device *op,
322 if (!parent) 322 if (!parent)
323 return; 323 return;
324 324
325 p_op = to_of_device(parent); 325 p_op = to_platform_device(parent);
326 bus = of_match_bus(p_op->dev.of_node); 326 bus = of_match_bus(p_op->dev.of_node);
327 bus->count_cells(op->dev.of_node, &na, &ns); 327 bus->count_cells(op->dev.of_node, &na, &ns);
328 328
@@ -344,6 +344,8 @@ static void __init build_device_resources(struct of_device *op,
344 num_reg = PROMREG_MAX; 344 num_reg = PROMREG_MAX;
345 } 345 }
346 346
347 op->resource = op->archdata.resource;
348 op->num_resources = num_reg;
347 for (index = 0; index < num_reg; index++) { 349 for (index = 0; index < num_reg; index++) {
348 struct resource *r = &op->resource[index]; 350 struct resource *r = &op->resource[index];
349 u32 addr[OF_MAX_ADDR_CELLS]; 351 u32 addr[OF_MAX_ADDR_CELLS];
@@ -526,7 +528,7 @@ static unsigned int __init pci_irq_swizzle(struct device_node *dp,
526 528
527static int of_irq_verbose; 529static int of_irq_verbose;
528 530
529static unsigned int __init build_one_device_irq(struct of_device *op, 531static unsigned int __init build_one_device_irq(struct platform_device *op,
530 struct device *parent, 532 struct device *parent,
531 unsigned int irq) 533 unsigned int irq)
532{ 534{
@@ -628,10 +630,10 @@ out:
628 return irq; 630 return irq;
629} 631}
630 632
631static struct of_device * __init scan_one_device(struct device_node *dp, 633static struct platform_device * __init scan_one_device(struct device_node *dp,
632 struct device *parent) 634 struct device *parent)
633{ 635{
634 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 636 struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
635 const unsigned int *irq; 637 const unsigned int *irq;
636 struct dev_archdata *sd; 638 struct dev_archdata *sd;
637 int len, i; 639 int len, i;
@@ -644,34 +646,28 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
644 646
645 op->dev.of_node = dp; 647 op->dev.of_node = dp;
646 648
647 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
648 (25*1000*1000));
649 op->portid = of_getintprop_default(dp, "upa-portid", -1);
650 if (op->portid == -1)
651 op->portid = of_getintprop_default(dp, "portid", -1);
652
653 irq = of_get_property(dp, "interrupts", &len); 649 irq = of_get_property(dp, "interrupts", &len);
654 if (irq) { 650 if (irq) {
655 op->num_irqs = len / 4; 651 op->archdata.num_irqs = len / 4;
656 652
657 /* Prevent overrunning the op->irqs[] array. */ 653 /* Prevent overrunning the op->irqs[] array. */
658 if (op->num_irqs > PROMINTR_MAX) { 654 if (op->archdata.num_irqs > PROMINTR_MAX) {
659 printk(KERN_WARNING "%s: Too many irqs (%d), " 655 printk(KERN_WARNING "%s: Too many irqs (%d), "
660 "limiting to %d.\n", 656 "limiting to %d.\n",
661 dp->full_name, op->num_irqs, PROMINTR_MAX); 657 dp->full_name, op->archdata.num_irqs, PROMINTR_MAX);
662 op->num_irqs = PROMINTR_MAX; 658 op->archdata.num_irqs = PROMINTR_MAX;
663 } 659 }
664 memcpy(op->irqs, irq, op->num_irqs * 4); 660 memcpy(op->archdata.irqs, irq, op->archdata.num_irqs * 4);
665 } else { 661 } else {
666 op->num_irqs = 0; 662 op->archdata.num_irqs = 0;
667 } 663 }
668 664
669 build_device_resources(op, parent); 665 build_device_resources(op, parent);
670 for (i = 0; i < op->num_irqs; i++) 666 for (i = 0; i < op->archdata.num_irqs; i++)
671 op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]); 667 op->archdata.irqs[i] = build_one_device_irq(op, parent, op->archdata.irqs[i]);
672 668
673 op->dev.parent = parent; 669 op->dev.parent = parent;
674 op->dev.bus = &of_platform_bus_type; 670 op->dev.bus = &platform_bus_type;
675 if (!parent) 671 if (!parent)
676 dev_set_name(&op->dev, "root"); 672 dev_set_name(&op->dev, "root");
677 else 673 else
@@ -690,7 +686,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
690static void __init scan_tree(struct device_node *dp, struct device *parent) 686static void __init scan_tree(struct device_node *dp, struct device *parent)
691{ 687{
692 while (dp) { 688 while (dp) {
693 struct of_device *op = scan_one_device(dp, parent); 689 struct platform_device *op = scan_one_device(dp, parent);
694 690
695 if (op) 691 if (op)
696 scan_tree(dp->child, &op->dev); 692 scan_tree(dp->child, &op->dev);
@@ -699,30 +695,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent)
699 } 695 }
700} 696}
701 697
702static void __init scan_of_devices(void) 698static int __init scan_of_devices(void)
703{ 699{
704 struct device_node *root = of_find_node_by_path("/"); 700 struct device_node *root = of_find_node_by_path("/");
705 struct of_device *parent; 701 struct platform_device *parent;
706 702
707 parent = scan_one_device(root, NULL); 703 parent = scan_one_device(root, NULL);
708 if (!parent) 704 if (!parent)
709 return; 705 return 0;
710 706
711 scan_tree(root->child, &parent->dev); 707 scan_tree(root->child, &parent->dev);
708 return 0;
712} 709}
713 710postcore_initcall(scan_of_devices);
714static int __init of_bus_driver_init(void)
715{
716 int err;
717
718 err = of_bus_type_init(&of_platform_bus_type, "of");
719 if (!err)
720 scan_of_devices();
721
722 return err;
723}
724
725postcore_initcall(of_bus_driver_init);
726 711
727static int __init of_debug(char *str) 712static int __init of_debug(char *str)
728{ 713{
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 10c6c36a6e7..49ddff56cb0 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -11,48 +11,28 @@
11 11
12#include "of_device_common.h" 12#include "of_device_common.h"
13 13
14static int node_match(struct device *dev, void *data)
15{
16 struct of_device *op = to_of_device(dev);
17 struct device_node *dp = data;
18
19 return (op->dev.of_node == dp);
20}
21
22struct of_device *of_find_device_by_node(struct device_node *dp)
23{
24 struct device *dev = bus_find_device(&of_platform_bus_type, NULL,
25 dp, node_match);
26
27 if (dev)
28 return to_of_device(dev);
29
30 return NULL;
31}
32EXPORT_SYMBOL(of_find_device_by_node);
33
34unsigned int irq_of_parse_and_map(struct device_node *node, int index) 14unsigned int irq_of_parse_and_map(struct device_node *node, int index)
35{ 15{
36 struct of_device *op = of_find_device_by_node(node); 16 struct platform_device *op = of_find_device_by_node(node);
37 17
38 if (!op || index >= op->num_irqs) 18 if (!op || index >= op->archdata.num_irqs)
39 return 0; 19 return 0;
40 20
41 return op->irqs[index]; 21 return op->archdata.irqs[index];
42} 22}
43EXPORT_SYMBOL(irq_of_parse_and_map); 23EXPORT_SYMBOL(irq_of_parse_and_map);
44 24
45/* Take the archdata values for IOMMU, STC, and HOSTDATA found in 25/* Take the archdata values for IOMMU, STC, and HOSTDATA found in
46 * BUS and propagate to all child of_device objects. 26 * BUS and propagate to all child platform_device objects.
47 */ 27 */
48void of_propagate_archdata(struct of_device *bus) 28void of_propagate_archdata(struct platform_device *bus)
49{ 29{
50 struct dev_archdata *bus_sd = &bus->dev.archdata; 30 struct dev_archdata *bus_sd = &bus->dev.archdata;
51 struct device_node *bus_dp = bus->dev.of_node; 31 struct device_node *bus_dp = bus->dev.of_node;
52 struct device_node *dp; 32 struct device_node *dp;
53 33
54 for (dp = bus_dp->child; dp; dp = dp->sibling) { 34 for (dp = bus_dp->child; dp; dp = dp->sibling) {
55 struct of_device *op = of_find_device_by_node(dp); 35 struct platform_device *op = of_find_device_by_node(dp);
56 36
57 op->dev.archdata.iommu = bus_sd->iommu; 37 op->dev.archdata.iommu = bus_sd->iommu;
58 op->dev.archdata.stc = bus_sd->stc; 38 op->dev.archdata.stc = bus_sd->stc;
@@ -64,9 +44,6 @@ void of_propagate_archdata(struct of_device *bus)
64 } 44 }
65} 45}
66 46
67struct bus_type of_platform_bus_type;
68EXPORT_SYMBOL(of_platform_bus_type);
69
70static void get_cells(struct device_node *dp, int *addrc, int *sizec) 47static void get_cells(struct device_node *dp, int *addrc, int *sizec)
71{ 48{
72 if (addrc) 49 if (addrc)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 8a8363adb8b..4137579d9ad 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -198,7 +198,7 @@ static unsigned long pci_parse_of_flags(u32 addr0)
198 * into physical address resources, we only have to figure out the register 198 * into physical address resources, we only have to figure out the register
199 * mapping. 199 * mapping.
200 */ 200 */
201static void pci_parse_of_addrs(struct of_device *op, 201static void pci_parse_of_addrs(struct platform_device *op,
202 struct device_node *node, 202 struct device_node *node,
203 struct pci_dev *dev) 203 struct pci_dev *dev)
204{ 204{
@@ -248,7 +248,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
248{ 248{
249 struct dev_archdata *sd; 249 struct dev_archdata *sd;
250 struct pci_slot *slot; 250 struct pci_slot *slot;
251 struct of_device *op; 251 struct platform_device *op;
252 struct pci_dev *dev; 252 struct pci_dev *dev;
253 const char *type; 253 const char *type;
254 u32 class; 254 u32 class;
@@ -340,7 +340,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
340 dev->hdr_type = PCI_HEADER_TYPE_NORMAL; 340 dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
341 dev->rom_base_reg = PCI_ROM_ADDRESS; 341 dev->rom_base_reg = PCI_ROM_ADDRESS;
342 342
343 dev->irq = sd->op->irqs[0]; 343 dev->irq = sd->op->archdata.irqs[0];
344 if (dev->irq == 0xffffffff) 344 if (dev->irq == 0xffffffff)
345 dev->irq = PCI_IRQ_NONE; 345 dev->irq = PCI_IRQ_NONE;
346 } 346 }
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index 51cfa09e392..efb896d6875 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -410,7 +410,7 @@ static void pci_fire_hw_init(struct pci_pbm_info *pbm)
410} 410}
411 411
412static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm, 412static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
413 struct of_device *op, u32 portid) 413 struct platform_device *op, u32 portid)
414{ 414{
415 const struct linux_prom64_registers *regs; 415 const struct linux_prom64_registers *regs;
416 struct device_node *dp = op->dev.of_node; 416 struct device_node *dp = op->dev.of_node;
@@ -455,7 +455,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
455 return 0; 455 return 0;
456} 456}
457 457
458static int __devinit fire_probe(struct of_device *op, 458static int __devinit fire_probe(struct platform_device *op,
459 const struct of_device_id *match) 459 const struct of_device_id *match)
460{ 460{
461 struct device_node *dp = op->dev.of_node; 461 struct device_node *dp = op->dev.of_node;
@@ -518,7 +518,7 @@ static struct of_platform_driver fire_driver = {
518 518
519static int __init fire_init(void) 519static int __init fire_init(void)
520{ 520{
521 return of_register_driver(&fire_driver, &of_bus_type); 521 return of_register_platform_driver(&fire_driver);
522} 522}
523 523
524subsys_initcall(fire_init); 524subsys_initcall(fire_init);
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 03186824327..e20ed5f06e9 100644
--- a/arch/sparc/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
@@ -91,7 +91,7 @@ struct pci_pbm_info {
91 char *name; 91 char *name;
92 92
93 /* OBP specific information. */ 93 /* OBP specific information. */
94 struct of_device *op; 94 struct platform_device *op;
95 u64 ino_bitmap; 95 u64 ino_bitmap;
96 96
97 /* PBM I/O and Memory space resources. */ 97 /* PBM I/O and Memory space resources. */
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index 558a7051282..22eab7cf3b1 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -285,7 +285,7 @@ static irqreturn_t psycho_ce_intr(int irq, void *dev_id)
285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */ 285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */
286static void psycho_register_error_handlers(struct pci_pbm_info *pbm) 286static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
287{ 287{
288 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); 288 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
289 unsigned long base = pbm->controller_regs; 289 unsigned long base = pbm->controller_regs;
290 u64 tmp; 290 u64 tmp;
291 int err; 291 int err;
@@ -302,23 +302,23 @@ static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
302 * 5: POWER MANAGEMENT 302 * 5: POWER MANAGEMENT
303 */ 303 */
304 304
305 if (op->num_irqs < 6) 305 if (op->archdata.num_irqs < 6)
306 return; 306 return;
307 307
308 /* We really mean to ignore the return result here. Two 308 /* We really mean to ignore the return result here. Two
309 * PCI controller share the same interrupt numbers and 309 * PCI controller share the same interrupt numbers and
310 * drive the same front-end hardware. 310 * drive the same front-end hardware.
311 */ 311 */
312 err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED, 312 err = request_irq(op->archdata.irqs[1], psycho_ue_intr, IRQF_SHARED,
313 "PSYCHO_UE", pbm); 313 "PSYCHO_UE", pbm);
314 err = request_irq(op->irqs[2], psycho_ce_intr, IRQF_SHARED, 314 err = request_irq(op->archdata.irqs[2], psycho_ce_intr, IRQF_SHARED,
315 "PSYCHO_CE", pbm); 315 "PSYCHO_CE", pbm);
316 316
317 /* This one, however, ought not to fail. We can just warn 317 /* This one, however, ought not to fail. We can just warn
318 * about it since the system can still operate properly even 318 * about it since the system can still operate properly even
319 * if this fails. 319 * if this fails.
320 */ 320 */
321 err = request_irq(op->irqs[0], psycho_pcierr_intr, IRQF_SHARED, 321 err = request_irq(op->archdata.irqs[0], psycho_pcierr_intr, IRQF_SHARED,
322 "PSYCHO_PCIERR", pbm); 322 "PSYCHO_PCIERR", pbm);
323 if (err) 323 if (err)
324 printk(KERN_WARNING "%s: Could not register PCIERR, " 324 printk(KERN_WARNING "%s: Could not register PCIERR, "
@@ -483,7 +483,7 @@ static void psycho_pbm_strbuf_init(struct pci_pbm_info *pbm,
483#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL 483#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL
484 484
485static void __devinit psycho_pbm_init(struct pci_pbm_info *pbm, 485static void __devinit psycho_pbm_init(struct pci_pbm_info *pbm,
486 struct of_device *op, int is_pbm_a) 486 struct platform_device *op, int is_pbm_a)
487{ 487{
488 psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO); 488 psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO);
489 psycho_pbm_strbuf_init(pbm, is_pbm_a); 489 psycho_pbm_strbuf_init(pbm, is_pbm_a);
@@ -503,7 +503,7 @@ static struct pci_pbm_info * __devinit psycho_find_sibling(u32 upa_portid)
503 503
504#define PSYCHO_CONFIGSPACE 0x001000000UL 504#define PSYCHO_CONFIGSPACE 0x001000000UL
505 505
506static int __devinit psycho_probe(struct of_device *op, 506static int __devinit psycho_probe(struct platform_device *op,
507 const struct of_device_id *match) 507 const struct of_device_id *match)
508{ 508{
509 const struct linux_prom64_registers *pr_regs; 509 const struct linux_prom64_registers *pr_regs;
@@ -612,7 +612,7 @@ static struct of_platform_driver psycho_driver = {
612 612
613static int __init psycho_init(void) 613static int __init psycho_init(void)
614{ 614{
615 return of_register_driver(&psycho_driver, &of_bus_type); 615 return of_register_platform_driver(&psycho_driver);
616} 616}
617 617
618subsys_initcall(psycho_init); 618subsys_initcall(psycho_init);
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 6dad8e3b750..5c3f5ec4cab 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -311,7 +311,7 @@ static irqreturn_t sabre_ce_intr(int irq, void *dev_id)
311static void sabre_register_error_handlers(struct pci_pbm_info *pbm) 311static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
312{ 312{
313 struct device_node *dp = pbm->op->dev.of_node; 313 struct device_node *dp = pbm->op->dev.of_node;
314 struct of_device *op; 314 struct platform_device *op;
315 unsigned long base = pbm->controller_regs; 315 unsigned long base = pbm->controller_regs;
316 u64 tmp; 316 u64 tmp;
317 int err; 317 int err;
@@ -329,7 +329,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
329 * 2: CE ERR 329 * 2: CE ERR
330 * 3: POWER FAIL 330 * 3: POWER FAIL
331 */ 331 */
332 if (op->num_irqs < 4) 332 if (op->archdata.num_irqs < 4)
333 return; 333 return;
334 334
335 /* We clear the error bits in the appropriate AFSR before 335 /* We clear the error bits in the appropriate AFSR before
@@ -341,7 +341,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
341 SABRE_UEAFSR_SDTE | SABRE_UEAFSR_PDTE), 341 SABRE_UEAFSR_SDTE | SABRE_UEAFSR_PDTE),
342 base + SABRE_UE_AFSR); 342 base + SABRE_UE_AFSR);
343 343
344 err = request_irq(op->irqs[1], sabre_ue_intr, 0, "SABRE_UE", pbm); 344 err = request_irq(op->archdata.irqs[1], sabre_ue_intr, 0, "SABRE_UE", pbm);
345 if (err) 345 if (err)
346 printk(KERN_WARNING "%s: Couldn't register UE, err=%d.\n", 346 printk(KERN_WARNING "%s: Couldn't register UE, err=%d.\n",
347 pbm->name, err); 347 pbm->name, err);
@@ -351,11 +351,11 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
351 base + SABRE_CE_AFSR); 351 base + SABRE_CE_AFSR);
352 352
353 353
354 err = request_irq(op->irqs[2], sabre_ce_intr, 0, "SABRE_CE", pbm); 354 err = request_irq(op->archdata.irqs[2], sabre_ce_intr, 0, "SABRE_CE", pbm);
355 if (err) 355 if (err)
356 printk(KERN_WARNING "%s: Couldn't register CE, err=%d.\n", 356 printk(KERN_WARNING "%s: Couldn't register CE, err=%d.\n",
357 pbm->name, err); 357 pbm->name, err);
358 err = request_irq(op->irqs[0], psycho_pcierr_intr, 0, 358 err = request_irq(op->archdata.irqs[0], psycho_pcierr_intr, 0,
359 "SABRE_PCIERR", pbm); 359 "SABRE_PCIERR", pbm);
360 if (err) 360 if (err)
361 printk(KERN_WARNING "%s: Couldn't register PCIERR, err=%d.\n", 361 printk(KERN_WARNING "%s: Couldn't register PCIERR, err=%d.\n",
@@ -443,7 +443,7 @@ static void __devinit sabre_scan_bus(struct pci_pbm_info *pbm,
443} 443}
444 444
445static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm, 445static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
446 struct of_device *op) 446 struct platform_device *op)
447{ 447{
448 psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE); 448 psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE);
449 pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR; 449 pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR;
@@ -452,7 +452,7 @@ static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
452 sabre_scan_bus(pbm, &op->dev); 452 sabre_scan_bus(pbm, &op->dev);
453} 453}
454 454
455static int __devinit sabre_probe(struct of_device *op, 455static int __devinit sabre_probe(struct platform_device *op,
456 const struct of_device_id *match) 456 const struct of_device_id *match)
457{ 457{
458 const struct linux_prom64_registers *pr_regs; 458 const struct linux_prom64_registers *pr_regs;
@@ -606,7 +606,7 @@ static struct of_platform_driver sabre_driver = {
606 606
607static int __init sabre_init(void) 607static int __init sabre_init(void)
608{ 608{
609 return of_register_driver(&sabre_driver, &of_bus_type); 609 return of_register_platform_driver(&sabre_driver);
610} 610}
611 611
612subsys_initcall(sabre_init); 612subsys_initcall(sabre_init);
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 97a1ae2e1c0..445a47a2fb3 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -844,7 +844,7 @@ static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino)
844 */ 844 */
845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) 845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
846{ 846{
847 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); 847 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
848 u64 tmp, err_mask, err_no_mask; 848 u64 tmp, err_mask, err_no_mask;
849 int err; 849 int err;
850 850
@@ -857,14 +857,14 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
857 */ 857 */
858 858
859 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { 859 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) {
860 err = request_irq(op->irqs[1], schizo_ue_intr, 0, 860 err = request_irq(op->archdata.irqs[1], schizo_ue_intr, 0,
861 "TOMATILLO_UE", pbm); 861 "TOMATILLO_UE", pbm);
862 if (err) 862 if (err)
863 printk(KERN_WARNING "%s: Could not register UE, " 863 printk(KERN_WARNING "%s: Could not register UE, "
864 "err=%d\n", pbm->name, err); 864 "err=%d\n", pbm->name, err);
865 } 865 }
866 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { 866 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) {
867 err = request_irq(op->irqs[2], schizo_ce_intr, 0, 867 err = request_irq(op->archdata.irqs[2], schizo_ce_intr, 0,
868 "TOMATILLO_CE", pbm); 868 "TOMATILLO_CE", pbm);
869 if (err) 869 if (err)
870 printk(KERN_WARNING "%s: Could not register CE, " 870 printk(KERN_WARNING "%s: Could not register CE, "
@@ -872,10 +872,10 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
872 } 872 }
873 err = 0; 873 err = 0;
874 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { 874 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) {
875 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 875 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
876 "TOMATILLO_PCIERR", pbm); 876 "TOMATILLO_PCIERR", pbm);
877 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { 877 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) {
878 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 878 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
879 "TOMATILLO_PCIERR", pbm); 879 "TOMATILLO_PCIERR", pbm);
880 } 880 }
881 if (err) 881 if (err)
@@ -883,7 +883,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
883 "err=%d\n", pbm->name, err); 883 "err=%d\n", pbm->name, err);
884 884
885 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { 885 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) {
886 err = request_irq(op->irqs[3], schizo_safarierr_intr, 0, 886 err = request_irq(op->archdata.irqs[3], schizo_safarierr_intr, 0,
887 "TOMATILLO_SERR", pbm); 887 "TOMATILLO_SERR", pbm);
888 if (err) 888 if (err)
889 printk(KERN_WARNING "%s: Could not register SERR, " 889 printk(KERN_WARNING "%s: Could not register SERR, "
@@ -939,7 +939,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
939 939
940static void schizo_register_error_handlers(struct pci_pbm_info *pbm) 940static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
941{ 941{
942 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); 942 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
943 u64 tmp, err_mask, err_no_mask; 943 u64 tmp, err_mask, err_no_mask;
944 int err; 944 int err;
945 945
@@ -952,14 +952,14 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
952 */ 952 */
953 953
954 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { 954 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) {
955 err = request_irq(op->irqs[1], schizo_ue_intr, 0, 955 err = request_irq(op->archdata.irqs[1], schizo_ue_intr, 0,
956 "SCHIZO_UE", pbm); 956 "SCHIZO_UE", pbm);
957 if (err) 957 if (err)
958 printk(KERN_WARNING "%s: Could not register UE, " 958 printk(KERN_WARNING "%s: Could not register UE, "
959 "err=%d\n", pbm->name, err); 959 "err=%d\n", pbm->name, err);
960 } 960 }
961 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { 961 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) {
962 err = request_irq(op->irqs[2], schizo_ce_intr, 0, 962 err = request_irq(op->archdata.irqs[2], schizo_ce_intr, 0,
963 "SCHIZO_CE", pbm); 963 "SCHIZO_CE", pbm);
964 if (err) 964 if (err)
965 printk(KERN_WARNING "%s: Could not register CE, " 965 printk(KERN_WARNING "%s: Could not register CE, "
@@ -967,10 +967,10 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
967 } 967 }
968 err = 0; 968 err = 0;
969 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { 969 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) {
970 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 970 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
971 "SCHIZO_PCIERR", pbm); 971 "SCHIZO_PCIERR", pbm);
972 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { 972 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) {
973 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 973 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
974 "SCHIZO_PCIERR", pbm); 974 "SCHIZO_PCIERR", pbm);
975 } 975 }
976 if (err) 976 if (err)
@@ -978,7 +978,7 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
978 "err=%d\n", pbm->name, err); 978 "err=%d\n", pbm->name, err);
979 979
980 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { 980 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) {
981 err = request_irq(op->irqs[3], schizo_safarierr_intr, 0, 981 err = request_irq(op->archdata.irqs[3], schizo_safarierr_intr, 0,
982 "SCHIZO_SERR", pbm); 982 "SCHIZO_SERR", pbm);
983 if (err) 983 if (err)
984 printk(KERN_WARNING "%s: Could not register SERR, " 984 printk(KERN_WARNING "%s: Could not register SERR, "
@@ -1307,7 +1307,7 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1307} 1307}
1308 1308
1309static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm, 1309static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm,
1310 struct of_device *op, u32 portid, 1310 struct platform_device *op, u32 portid,
1311 int chip_type) 1311 int chip_type)
1312{ 1312{
1313 const struct linux_prom64_registers *regs; 1313 const struct linux_prom64_registers *regs;
@@ -1413,7 +1413,7 @@ static struct pci_pbm_info * __devinit schizo_find_sibling(u32 portid,
1413 return NULL; 1413 return NULL;
1414} 1414}
1415 1415
1416static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type) 1416static int __devinit __schizo_init(struct platform_device *op, unsigned long chip_type)
1417{ 1417{
1418 struct device_node *dp = op->dev.of_node; 1418 struct device_node *dp = op->dev.of_node;
1419 struct pci_pbm_info *pbm; 1419 struct pci_pbm_info *pbm;
@@ -1460,7 +1460,7 @@ out_err:
1460 return err; 1460 return err;
1461} 1461}
1462 1462
1463static int __devinit schizo_probe(struct of_device *op, 1463static int __devinit schizo_probe(struct platform_device *op,
1464 const struct of_device_id *match) 1464 const struct of_device_id *match)
1465{ 1465{
1466 return __schizo_init(op, (unsigned long) match->data); 1466 return __schizo_init(op, (unsigned long) match->data);
@@ -1501,7 +1501,7 @@ static struct of_platform_driver schizo_driver = {
1501 1501
1502static int __init schizo_init(void) 1502static int __init schizo_init(void)
1503{ 1503{
1504 return of_register_driver(&schizo_driver, &of_bus_type); 1504 return of_register_platform_driver(&schizo_driver);
1505} 1505}
1506 1506
1507subsys_initcall(schizo_init); 1507subsys_initcall(schizo_init);
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index a24af6f7e17..743344aa6d8 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -879,7 +879,7 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
879#endif /* !(CONFIG_PCI_MSI) */ 879#endif /* !(CONFIG_PCI_MSI) */
880 880
881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm, 881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
882 struct of_device *op, u32 devhandle) 882 struct platform_device *op, u32 devhandle)
883{ 883{
884 struct device_node *dp = op->dev.of_node; 884 struct device_node *dp = op->dev.of_node;
885 int err; 885 int err;
@@ -918,7 +918,7 @@ static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
918 return 0; 918 return 0;
919} 919}
920 920
921static int __devinit pci_sun4v_probe(struct of_device *op, 921static int __devinit pci_sun4v_probe(struct platform_device *op,
922 const struct of_device_id *match) 922 const struct of_device_id *match)
923{ 923{
924 const struct linux_prom64_registers *regs; 924 const struct linux_prom64_registers *regs;
@@ -1019,7 +1019,7 @@ static struct of_platform_driver pci_sun4v_driver = {
1019 1019
1020static int __init pci_sun4v_init(void) 1020static int __init pci_sun4v_init(void)
1021{ 1021{
1022 return of_register_driver(&pci_sun4v_driver, &of_bus_type); 1022 return of_register_platform_driver(&pci_sun4v_driver);
1023} 1023}
1024 1024
1025subsys_initcall(pci_sun4v_init); 1025subsys_initcall(pci_sun4v_init);
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 9589d8b9b0c..94536a85f16 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -51,7 +51,7 @@ static void pmc_swift_idle(void)
51#endif 51#endif
52} 52}
53 53
54static int __devinit pmc_probe(struct of_device *op, 54static int __devinit pmc_probe(struct platform_device *op,
55 const struct of_device_id *match) 55 const struct of_device_id *match)
56{ 56{
57 regs = of_ioremap(&op->resource[0], 0, 57 regs = of_ioremap(&op->resource[0], 0,
@@ -89,7 +89,7 @@ static struct of_platform_driver pmc_driver = {
89 89
90static int __init pmc_init(void) 90static int __init pmc_init(void)
91{ 91{
92 return of_register_driver(&pmc_driver, &of_bus_type); 92 return of_register_platform_driver(&pmc_driver);
93} 93}
94 94
95/* This driver is not critical to the boot process 95/* This driver is not critical to the boot process
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index 168d4cb63f5..2c59f4d387d 100644
--- a/arch/sparc/kernel/power.c
+++ b/arch/sparc/kernel/power.c
@@ -33,10 +33,10 @@ static int __devinit has_button_interrupt(unsigned int irq, struct device_node *
33 return 1; 33 return 1;
34} 34}
35 35
36static int __devinit power_probe(struct of_device *op, const struct of_device_id *match) 36static int __devinit power_probe(struct platform_device *op, const struct of_device_id *match)
37{ 37{
38 struct resource *res = &op->resource[0]; 38 struct resource *res = &op->resource[0];
39 unsigned int irq= op->irqs[0]; 39 unsigned int irq = op->archdata.irqs[0];
40 40
41 power_reg = of_ioremap(res, 0, 0x4, "power"); 41 power_reg = of_ioremap(res, 0, 0x4, "power");
42 42
@@ -70,7 +70,7 @@ static struct of_platform_driver power_driver = {
70 70
71static int __init power_init(void) 71static int __init power_init(void)
72{ 72{
73 return of_register_driver(&power_driver, &of_platform_bus_type); 73 return of_register_platform_driver(&power_driver);
74} 74}
75 75
76device_initcall(power_init); 76device_initcall(power_init);
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index a8591ef2636..eeb04a782ec 100644
--- a/arch/sparc/kernel/prom.h
+++ b/arch/sparc/kernel/prom.h
@@ -9,14 +9,6 @@ extern void irq_trans_init(struct device_node *dp);
9 9
10extern unsigned int prom_unique_id; 10extern unsigned int prom_unique_id;
11 11
12static inline int is_root_node(const struct device_node *dp)
13{
14 if (!dp)
15 return 0;
16
17 return (dp->parent == NULL);
18}
19
20extern char *build_path_component(struct device_node *dp); 12extern char *build_path_component(struct device_node *dp);
21extern void of_console_init(void); 13extern void of_console_init(void);
22 14
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index 466a32763ea..86597d9867f 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -21,7 +21,7 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/memblock.h> 23#include <linux/memblock.h>
24#include <linux/of_device.h> 24#include <linux/of.h>
25 25
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include <asm/oplib.h> 27#include <asm/oplib.h>
@@ -81,7 +81,7 @@ static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
81 return; 81 return;
82 82
83 regs = rprop->value; 83 regs = rprop->value;
84 if (!is_root_node(dp->parent)) { 84 if (!of_node_is_root(dp->parent)) {
85 sprintf(tmp_buf, "%s@%x,%x", 85 sprintf(tmp_buf, "%s@%x,%x",
86 dp->name, 86 dp->name,
87 (unsigned int) (regs->phys_addr >> 32UL), 87 (unsigned int) (regs->phys_addr >> 32UL),
@@ -121,7 +121,7 @@ static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
121 return; 121 return;
122 122
123 regs = prop->value; 123 regs = prop->value;
124 if (!is_root_node(dp->parent)) { 124 if (!of_node_is_root(dp->parent)) {
125 sprintf(tmp_buf, "%s@%x,%x", 125 sprintf(tmp_buf, "%s@%x,%x",
126 dp->name, 126 dp->name,
127 (unsigned int) (regs->phys_addr >> 32UL), 127 (unsigned int) (regs->phys_addr >> 32UL),
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index 57ac9e28be0..1f830da2ddf 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -244,7 +244,7 @@ char * __init build_full_name(struct device_node *dp)
244 244
245 n = prom_early_alloc(len); 245 n = prom_early_alloc(len);
246 strcpy(n, dp->parent->full_name); 246 strcpy(n, dp->parent->full_name);
247 if (!is_root_node(dp->parent)) { 247 if (!of_node_is_root(dp->parent)) {
248 strcpy(n + plen, "/"); 248 strcpy(n + plen, "/");
249 plen++; 249 plen++;
250 } 250 }
diff --git a/arch/sparc/kernel/prom_irqtrans.c b/arch/sparc/kernel/prom_irqtrans.c
index 5702ad4710c..ce651147fab 100644
--- a/arch/sparc/kernel/prom_irqtrans.c
+++ b/arch/sparc/kernel/prom_irqtrans.c
@@ -719,7 +719,7 @@ static unsigned int central_build_irq(struct device_node *dp,
719 void *_data) 719 void *_data)
720{ 720{
721 struct device_node *central_dp = _data; 721 struct device_node *central_dp = _data;
722 struct of_device *central_op = of_find_device_by_node(central_dp); 722 struct platform_device *central_op = of_find_device_by_node(central_dp);
723 struct resource *res; 723 struct resource *res;
724 unsigned long imap, iclr; 724 unsigned long imap, iclr;
725 u32 tmp; 725 u32 tmp;
diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 3f34ac85393..fe2af66bb19 100644
--- a/arch/sparc/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
@@ -447,7 +447,7 @@ int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
447 447
448} 448}
449 449
450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op, 450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op,
451 const char *chip_name, int chip_type) 451 const char *chip_name, int chip_type)
452{ 452{
453 struct device_node *dp = op->dev.of_node; 453 struct device_node *dp = op->dev.of_node;
diff --git a/arch/sparc/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h
index 092c278ef28..590b4ed8ab5 100644
--- a/arch/sparc/kernel/psycho_common.h
+++ b/arch/sparc/kernel/psycho_common.h
@@ -42,7 +42,7 @@ extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
42 unsigned long write_complete_offset); 42 unsigned long write_complete_offset);
43 43
44extern void psycho_pbm_init_common(struct pci_pbm_info *pbm, 44extern void psycho_pbm_init_common(struct pci_pbm_info *pbm,
45 struct of_device *op, 45 struct platform_device *op,
46 const char *chip_name, int chip_type); 46 const char *chip_name, int chip_type);
47 47
48#endif /* _PSYCHO_COMMON_H */ 48#endif /* _PSYCHO_COMMON_H */
diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index cfeaf04b9cd..2ca32d13abc 100644
--- a/arch/sparc/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
@@ -57,7 +57,7 @@
57void sbus_set_sbus64(struct device *dev, int bursts) 57void sbus_set_sbus64(struct device *dev, int bursts)
58{ 58{
59 struct iommu *iommu = dev->archdata.iommu; 59 struct iommu *iommu = dev->archdata.iommu;
60 struct of_device *op = to_of_device(dev); 60 struct platform_device *op = to_platform_device(dev);
61 const struct linux_prom_registers *regs; 61 const struct linux_prom_registers *regs;
62 unsigned long cfg_reg; 62 unsigned long cfg_reg;
63 int slot; 63 int slot;
@@ -204,7 +204,7 @@ static unsigned long sysio_imap_to_iclr(unsigned long imap)
204 return imap + diff; 204 return imap + diff;
205} 205}
206 206
207static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino) 207static unsigned int sbus_build_irq(struct platform_device *op, unsigned int ino)
208{ 208{
209 struct iommu *iommu = op->dev.archdata.iommu; 209 struct iommu *iommu = op->dev.archdata.iommu;
210 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 210 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
@@ -267,7 +267,7 @@ static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino)
267#define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ 267#define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */
268static irqreturn_t sysio_ue_handler(int irq, void *dev_id) 268static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
269{ 269{
270 struct of_device *op = dev_id; 270 struct platform_device *op = dev_id;
271 struct iommu *iommu = op->dev.archdata.iommu; 271 struct iommu *iommu = op->dev.archdata.iommu;
272 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 272 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
273 unsigned long afsr_reg, afar_reg; 273 unsigned long afsr_reg, afar_reg;
@@ -341,7 +341,7 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
341#define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ 341#define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */
342static irqreturn_t sysio_ce_handler(int irq, void *dev_id) 342static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
343{ 343{
344 struct of_device *op = dev_id; 344 struct platform_device *op = dev_id;
345 struct iommu *iommu = op->dev.archdata.iommu; 345 struct iommu *iommu = op->dev.archdata.iommu;
346 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 346 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
347 unsigned long afsr_reg, afar_reg; 347 unsigned long afsr_reg, afar_reg;
@@ -420,7 +420,7 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
420#define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */ 420#define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */
421static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) 421static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
422{ 422{
423 struct of_device *op = dev_id; 423 struct platform_device *op = dev_id;
424 struct iommu *iommu = op->dev.archdata.iommu; 424 struct iommu *iommu = op->dev.archdata.iommu;
425 unsigned long afsr_reg, afar_reg, reg_base; 425 unsigned long afsr_reg, afar_reg, reg_base;
426 unsigned long afsr, afar, error_bits; 426 unsigned long afsr, afar, error_bits;
@@ -488,7 +488,7 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
488#define SYSIO_CE_INO 0x35 488#define SYSIO_CE_INO 0x35
489#define SYSIO_SBUSERR_INO 0x36 489#define SYSIO_SBUSERR_INO 0x36
490 490
491static void __init sysio_register_error_handlers(struct of_device *op) 491static void __init sysio_register_error_handlers(struct platform_device *op)
492{ 492{
493 struct iommu *iommu = op->dev.archdata.iommu; 493 struct iommu *iommu = op->dev.archdata.iommu;
494 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 494 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
@@ -534,7 +534,7 @@ static void __init sysio_register_error_handlers(struct of_device *op)
534} 534}
535 535
536/* Boot time initialization. */ 536/* Boot time initialization. */
537static void __init sbus_iommu_init(struct of_device *op) 537static void __init sbus_iommu_init(struct platform_device *op)
538{ 538{
539 const struct linux_prom64_registers *pr; 539 const struct linux_prom64_registers *pr;
540 struct device_node *dp = op->dev.of_node; 540 struct device_node *dp = op->dev.of_node;
@@ -663,7 +663,7 @@ static int __init sbus_init(void)
663 struct device_node *dp; 663 struct device_node *dp;
664 664
665 for_each_node_by_name(dp, "sbus") { 665 for_each_node_by_name(dp, "sbus") {
666 struct of_device *op = of_find_device_by_node(dp); 666 struct platform_device *op = of_find_device_by_node(dp);
667 667
668 sbus_iommu_init(op); 668 sbus_iommu_init(op);
669 of_propagate_archdata(op); 669 of_propagate_archdata(op);
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index c0ca87553e1..e6375a750d9 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -162,7 +162,7 @@ static int cp_compat_stat64(struct kstat *stat,
162 return err; 162 return err;
163} 163}
164 164
165asmlinkage long compat_sys_stat64(char __user * filename, 165asmlinkage long compat_sys_stat64(const char __user * filename,
166 struct compat_stat64 __user *statbuf) 166 struct compat_stat64 __user *statbuf)
167{ 167{
168 struct kstat stat; 168 struct kstat stat;
@@ -173,7 +173,7 @@ asmlinkage long compat_sys_stat64(char __user * filename,
173 return error; 173 return error;
174} 174}
175 175
176asmlinkage long compat_sys_lstat64(char __user * filename, 176asmlinkage long compat_sys_lstat64(const char __user * filename,
177 struct compat_stat64 __user *statbuf) 177 struct compat_stat64 __user *statbuf)
178{ 178{
179 struct kstat stat; 179 struct kstat stat;
@@ -195,7 +195,8 @@ asmlinkage long compat_sys_fstat64(unsigned int fd,
195 return error; 195 return error;
196} 196}
197 197
198asmlinkage long compat_sys_fstatat64(unsigned int dfd, char __user *filename, 198asmlinkage long compat_sys_fstatat64(unsigned int dfd,
199 const char __user *filename,
199 struct compat_stat64 __user * statbuf, int flag) 200 struct compat_stat64 __user * statbuf, int flag)
200{ 201{
201 struct kstat stat; 202 struct kstat stat;
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index e404b063be2..9c743b1886f 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -142,7 +142,7 @@ static struct platform_device m48t59_rtc = {
142 }, 142 },
143}; 143};
144 144
145static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match) 145static int __devinit clock_probe(struct platform_device *op, const struct of_device_id *match)
146{ 146{
147 struct device_node *dp = op->dev.of_node; 147 struct device_node *dp = op->dev.of_node;
148 const char *model = of_get_property(dp, "model", NULL); 148 const char *model = of_get_property(dp, "model", NULL);
@@ -189,7 +189,7 @@ static struct of_platform_driver clock_driver = {
189/* Probe for the mostek real time clock chip. */ 189/* Probe for the mostek real time clock chip. */
190static int __init clock_init(void) 190static int __init clock_init(void)
191{ 191{
192 return of_register_driver(&clock_driver, &of_platform_bus_type); 192 return of_register_platform_driver(&clock_driver);
193} 193}
194/* Must be after subsys_initcall() so that busses are probed. Must 194/* Must be after subsys_initcall() so that busses are probed. Must
195 * be before device_initcall() because things like the RTC driver 195 * be before device_initcall() because things like the RTC driver
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 21e9fcae066..3bc9c9979b9 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -419,7 +419,7 @@ static struct platform_device rtc_cmos_device = {
419 .num_resources = 1, 419 .num_resources = 1,
420}; 420};
421 421
422static int __devinit rtc_probe(struct of_device *op, const struct of_device_id *match) 422static int __devinit rtc_probe(struct platform_device *op, const struct of_device_id *match)
423{ 423{
424 struct resource *r; 424 struct resource *r;
425 425
@@ -477,7 +477,7 @@ static struct platform_device rtc_bq4802_device = {
477 .num_resources = 1, 477 .num_resources = 1,
478}; 478};
479 479
480static int __devinit bq4802_probe(struct of_device *op, const struct of_device_id *match) 480static int __devinit bq4802_probe(struct platform_device *op, const struct of_device_id *match)
481{ 481{
482 482
483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n", 483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n",
@@ -534,7 +534,7 @@ static struct platform_device m48t59_rtc = {
534 }, 534 },
535}; 535};
536 536
537static int __devinit mostek_probe(struct of_device *op, const struct of_device_id *match) 537static int __devinit mostek_probe(struct platform_device *op, const struct of_device_id *match)
538{ 538{
539 struct device_node *dp = op->dev.of_node; 539 struct device_node *dp = op->dev.of_node;
540 540
@@ -586,9 +586,9 @@ static int __init clock_init(void)
586 if (tlb_type == hypervisor) 586 if (tlb_type == hypervisor)
587 return platform_device_register(&rtc_sun4v_device); 587 return platform_device_register(&rtc_sun4v_device);
588 588
589 (void) of_register_driver(&rtc_driver, &of_platform_bus_type); 589 (void) of_register_platform_driver(&rtc_driver);
590 (void) of_register_driver(&mostek_driver, &of_platform_bus_type); 590 (void) of_register_platform_driver(&mostek_driver);
591 (void) of_register_driver(&bq4802_driver, &of_platform_bus_type); 591 (void) of_register_platform_driver(&bq4802_driver);
592 592
593 return 0; 593 return 0;
594} 594}