diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-04-23 23:53:04 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-24 08:09:02 -0400 |
commit | 30686ba6d56858657829d3eb524ed73e5dc98d2b (patch) | |
tree | 42bf3cea4dc7028fec30377560b367cd8274825e /arch/powerpc | |
parent | 1658ab66781d918f604c6069c5cf9a94b6f52f84 (diff) |
[POWERPC] Remove old interface find_devices
Replace uses with of_find_node_by_name and for_each_node_by_name.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 19 | ||||
-rw-r--r-- | arch/powerpc/kernel/vio.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/chrp/pci.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/chrp/setup.c | 9 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/backlight.c | 7 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/feature.c | 45 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/pci.c | 23 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/setup.c | 25 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/smp.c | 5 |
9 files changed, 78 insertions, 64 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 860c88b2f6d1..caef555f2dc0 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -1072,25 +1072,6 @@ int of_n_size_cells(struct device_node* np) | |||
1072 | } | 1072 | } |
1073 | EXPORT_SYMBOL(of_n_size_cells); | 1073 | EXPORT_SYMBOL(of_n_size_cells); |
1074 | 1074 | ||
1075 | /** | ||
1076 | * Construct and return a list of the device_nodes with a given name. | ||
1077 | */ | ||
1078 | struct device_node *find_devices(const char *name) | ||
1079 | { | ||
1080 | struct device_node *head, **prevp, *np; | ||
1081 | |||
1082 | prevp = &head; | ||
1083 | for (np = allnodes; np != 0; np = np->allnext) { | ||
1084 | if (np->name != 0 && strcasecmp(np->name, name) == 0) { | ||
1085 | *prevp = np; | ||
1086 | prevp = &np->next; | ||
1087 | } | ||
1088 | } | ||
1089 | *prevp = NULL; | ||
1090 | return head; | ||
1091 | } | ||
1092 | EXPORT_SYMBOL(find_devices); | ||
1093 | |||
1094 | /** Checks if the given "compat" string matches one of the strings in | 1075 | /** Checks if the given "compat" string matches one of the strings in |
1095 | * the device's "compatible" property | 1076 | * the device's "compatible" property |
1096 | */ | 1077 | */ |
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index a09277a8639f..9eaefac5053f 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -308,7 +308,7 @@ static int __init vio_bus_init(void) | |||
308 | return err; | 308 | return err; |
309 | } | 309 | } |
310 | 310 | ||
311 | node_vroot = find_devices("vdevice"); | 311 | node_vroot = of_find_node_by_name(NULL, "vdevice"); |
312 | if (node_vroot) { | 312 | if (node_vroot) { |
313 | struct device_node *of_node; | 313 | struct device_node *of_node; |
314 | 314 | ||
@@ -322,6 +322,7 @@ static int __init vio_bus_init(void) | |||
322 | __FUNCTION__, of_node); | 322 | __FUNCTION__, of_node); |
323 | vio_register_device_node(of_node); | 323 | vio_register_device_node(of_node); |
324 | } | 324 | } |
325 | of_node_put(node_vroot); | ||
325 | } | 326 | } |
326 | 327 | ||
327 | return 0; | 328 | return 0; |
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c index de776e3889e3..1469d6478f67 100644 --- a/arch/powerpc/platforms/chrp/pci.c +++ b/arch/powerpc/platforms/chrp/pci.c | |||
@@ -136,9 +136,11 @@ hydra_init(void) | |||
136 | struct device_node *np; | 136 | struct device_node *np; |
137 | struct resource r; | 137 | struct resource r; |
138 | 138 | ||
139 | np = find_devices("mac-io"); | 139 | np = of_find_node_by_name(NULL, "mac-io"); |
140 | if (np == NULL || of_address_to_resource(np, 0, &r)) | 140 | if (np == NULL || of_address_to_resource(np, 0, &r)) { |
141 | of_node_put(np); | ||
141 | return 0; | 142 | return 0; |
143 | } | ||
142 | Hydra = ioremap(r.start, r.end-r.start); | 144 | Hydra = ioremap(r.start, r.end-r.start); |
143 | printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start); | 145 | printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start); |
144 | printk("Hydra Feature_Control was %x", | 146 | printk("Hydra Feature_Control was %x", |
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c index 9c1b231b1ff9..1870038a8e0a 100644 --- a/arch/powerpc/platforms/chrp/setup.c +++ b/arch/powerpc/platforms/chrp/setup.c | |||
@@ -468,7 +468,7 @@ static void __init chrp_find_8259(void) | |||
468 | * Also, Pegasos-type platforms don't have a proper node to start | 468 | * Also, Pegasos-type platforms don't have a proper node to start |
469 | * from anyway | 469 | * from anyway |
470 | */ | 470 | */ |
471 | for (np = find_devices("pci"); np != NULL; np = np->next) { | 471 | for_each_node_by_name(np, "pci") { |
472 | const unsigned int *addrp = of_get_property(np, | 472 | const unsigned int *addrp = of_get_property(np, |
473 | "8259-interrupt-acknowledge", NULL); | 473 | "8259-interrupt-acknowledge", NULL); |
474 | 474 | ||
@@ -477,6 +477,7 @@ static void __init chrp_find_8259(void) | |||
477 | chrp_int_ack = addrp[of_n_addr_cells(np)-1]; | 477 | chrp_int_ack = addrp[of_n_addr_cells(np)-1]; |
478 | break; | 478 | break; |
479 | } | 479 | } |
480 | of_node_put(np); | ||
480 | if (np == NULL) | 481 | if (np == NULL) |
481 | printk(KERN_WARNING "Cannot find PCI interrupt acknowledge" | 482 | printk(KERN_WARNING "Cannot find PCI interrupt acknowledge" |
482 | " address, polling\n"); | 483 | " address, polling\n"); |
@@ -518,10 +519,11 @@ void __init chrp_init_IRQ(void) | |||
518 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON) | 519 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON) |
519 | /* see if there is a keyboard in the device tree | 520 | /* see if there is a keyboard in the device tree |
520 | with a parent of type "adb" */ | 521 | with a parent of type "adb" */ |
521 | for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next) | 522 | for_each_node_by_name(kbd, "keyboard") |
522 | if (kbd->parent && kbd->parent->type | 523 | if (kbd->parent && kbd->parent->type |
523 | && strcmp(kbd->parent->type, "adb") == 0) | 524 | && strcmp(kbd->parent->type, "adb") == 0) |
524 | break; | 525 | break; |
526 | of_node_put(kbd); | ||
525 | if (kbd) | 527 | if (kbd) |
526 | setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction); | 528 | setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction); |
527 | #endif | 529 | #endif |
@@ -547,7 +549,7 @@ chrp_init2(void) | |||
547 | /* Get the event scan rate for the rtas so we know how | 549 | /* Get the event scan rate for the rtas so we know how |
548 | * often it expects a heartbeat. -- Cort | 550 | * often it expects a heartbeat. -- Cort |
549 | */ | 551 | */ |
550 | device = find_devices("rtas"); | 552 | device = of_find_node_by_name(NULL, "rtas"); |
551 | if (device) | 553 | if (device) |
552 | p = of_get_property(device, "rtas-event-scan-rate", NULL); | 554 | p = of_get_property(device, "rtas-event-scan-rate", NULL); |
553 | if (p && *p) { | 555 | if (p && *p) { |
@@ -576,6 +578,7 @@ chrp_init2(void) | |||
576 | printk("RTAS Event Scan Rate: %u (%lu jiffies)\n", | 578 | printk("RTAS Event Scan Rate: %u (%lu jiffies)\n", |
577 | *p, interval); | 579 | *p, interval); |
578 | } | 580 | } |
581 | of_node_put(device); | ||
579 | 582 | ||
580 | if (ppc_md.progress) | 583 | if (ppc_md.progress) |
581 | ppc_md.progress(" Have fun! ", 0x7777); | 584 | ppc_md.progress(" Have fun! ", 0x7777); |
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c index 0dc8a45c408a..d679964ae2ab 100644 --- a/arch/powerpc/platforms/powermac/backlight.c +++ b/arch/powerpc/platforms/powermac/backlight.c | |||
@@ -56,13 +56,16 @@ struct backlight_device *pmac_backlight; | |||
56 | 56 | ||
57 | int pmac_has_backlight_type(const char *type) | 57 | int pmac_has_backlight_type(const char *type) |
58 | { | 58 | { |
59 | struct device_node* bk_node = find_devices("backlight"); | 59 | struct device_node* bk_node = of_find_node_by_name(NULL, "backlight"); |
60 | 60 | ||
61 | if (bk_node) { | 61 | if (bk_node) { |
62 | const char *prop = of_get_property(bk_node, | 62 | const char *prop = of_get_property(bk_node, |
63 | "backlight-control", NULL); | 63 | "backlight-control", NULL); |
64 | if (prop && strncmp(prop, type, strlen(type)) == 0) | 64 | if (prop && strncmp(prop, type, strlen(type)) == 0) { |
65 | of_node_put(bk_node); | ||
65 | return 1; | 66 | return 1; |
67 | } | ||
68 | of_node_put(bk_node); | ||
66 | } | 69 | } |
67 | 70 | ||
68 | return 0; | 71 | return 0; |
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index 44f85507db3c..52cfdd86c928 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c | |||
@@ -2408,12 +2408,13 @@ static int __init probe_motherboard(void) | |||
2408 | struct macio_chip *macio = &macio_chips[0]; | 2408 | struct macio_chip *macio = &macio_chips[0]; |
2409 | const char *model = NULL; | 2409 | const char *model = NULL; |
2410 | struct device_node *dt; | 2410 | struct device_node *dt; |
2411 | int ret = 0; | ||
2411 | 2412 | ||
2412 | /* Lookup known motherboard type in device-tree. First try an | 2413 | /* Lookup known motherboard type in device-tree. First try an |
2413 | * exact match on the "model" property, then try a "compatible" | 2414 | * exact match on the "model" property, then try a "compatible" |
2414 | * match is none is found. | 2415 | * match is none is found. |
2415 | */ | 2416 | */ |
2416 | dt = find_devices("device-tree"); | 2417 | dt = of_find_node_by_name(NULL, "device-tree"); |
2417 | if (dt != NULL) | 2418 | if (dt != NULL) |
2418 | model = of_get_property(dt, "model", NULL); | 2419 | model = of_get_property(dt, "model", NULL); |
2419 | for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { | 2420 | for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { |
@@ -2478,15 +2479,18 @@ static int __init probe_motherboard(void) | |||
2478 | break; | 2479 | break; |
2479 | #endif /* CONFIG_POWER4 */ | 2480 | #endif /* CONFIG_POWER4 */ |
2480 | default: | 2481 | default: |
2481 | return -ENODEV; | 2482 | ret = -ENODEV; |
2483 | goto done; | ||
2482 | } | 2484 | } |
2483 | found: | 2485 | found: |
2484 | #ifndef CONFIG_POWER4 | 2486 | #ifndef CONFIG_POWER4 |
2485 | /* Fixup Hooper vs. Comet */ | 2487 | /* Fixup Hooper vs. Comet */ |
2486 | if (pmac_mb.model_id == PMAC_TYPE_HOOPER) { | 2488 | if (pmac_mb.model_id == PMAC_TYPE_HOOPER) { |
2487 | u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4); | 2489 | u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4); |
2488 | if (!mach_id_ptr) | 2490 | if (!mach_id_ptr) { |
2489 | return -ENODEV; | 2491 | ret = -ENODEV; |
2492 | goto done; | ||
2493 | } | ||
2490 | /* Here, I used to disable the media-bay on comet. It | 2494 | /* Here, I used to disable the media-bay on comet. It |
2491 | * appears this is wrong, the floppy connector is actually | 2495 | * appears this is wrong, the floppy connector is actually |
2492 | * a kind of media-bay and works with the current driver. | 2496 | * a kind of media-bay and works with the current driver. |
@@ -2544,7 +2548,9 @@ found: | |||
2544 | 2548 | ||
2545 | 2549 | ||
2546 | printk(KERN_INFO "PowerMac motherboard: %s\n", pmac_mb.model_name); | 2550 | printk(KERN_INFO "PowerMac motherboard: %s\n", pmac_mb.model_name); |
2547 | return 0; | 2551 | done: |
2552 | of_node_put(dt); | ||
2553 | return ret; | ||
2548 | } | 2554 | } |
2549 | 2555 | ||
2550 | /* Initialize the Core99 UniNorth host bridge and memory controller | 2556 | /* Initialize the Core99 UniNorth host bridge and memory controller |
@@ -2747,12 +2753,14 @@ set_initial_features(void) | |||
2747 | * differenciate them all and since that hack was there for a long | 2753 | * differenciate them all and since that hack was there for a long |
2748 | * time, I'll keep it around | 2754 | * time, I'll keep it around |
2749 | */ | 2755 | */ |
2750 | if (macio_chips[0].type == macio_ohare && !find_devices("via-pmu")) { | 2756 | if (macio_chips[0].type == macio_ohare) { |
2751 | struct macio_chip *macio = &macio_chips[0]; | ||
2752 | MACIO_OUT32(OHARE_FCR, STARMAX_FEATURES); | ||
2753 | } else if (macio_chips[0].type == macio_ohare) { | ||
2754 | struct macio_chip *macio = &macio_chips[0]; | 2757 | struct macio_chip *macio = &macio_chips[0]; |
2755 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); | 2758 | np = of_find_node_by_name(NULL, "via-pmu"); |
2759 | if (np) | ||
2760 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); | ||
2761 | else | ||
2762 | MACIO_OUT32(OHARE_FCR, STARMAX_FEATURES); | ||
2763 | of_node_put(np); | ||
2756 | } else if (macio_chips[1].type == macio_ohare) { | 2764 | } else if (macio_chips[1].type == macio_ohare) { |
2757 | struct macio_chip *macio = &macio_chips[1]; | 2765 | struct macio_chip *macio = &macio_chips[1]; |
2758 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); | 2766 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); |
@@ -2845,14 +2853,13 @@ set_initial_features(void) | |||
2845 | } | 2853 | } |
2846 | 2854 | ||
2847 | /* Switch airport off */ | 2855 | /* Switch airport off */ |
2848 | np = find_devices("radio"); | 2856 | for_each_node_by_name(np, "radio") { |
2849 | while(np) { | ||
2850 | if (np && np->parent == macio_chips[0].of_node) { | 2857 | if (np && np->parent == macio_chips[0].of_node) { |
2851 | macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON; | 2858 | macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON; |
2852 | core99_airport_enable(np, 0, 0); | 2859 | core99_airport_enable(np, 0, 0); |
2853 | } | 2860 | } |
2854 | np = np->next; | ||
2855 | } | 2861 | } |
2862 | of_node_put(np); | ||
2856 | } | 2863 | } |
2857 | 2864 | ||
2858 | /* On all machines that support sound PM, switch sound off */ | 2865 | /* On all machines that support sound PM, switch sound off */ |
@@ -2872,16 +2879,12 @@ set_initial_features(void) | |||
2872 | #endif /* CONFIG_POWER4 */ | 2879 | #endif /* CONFIG_POWER4 */ |
2873 | 2880 | ||
2874 | /* On all machines, switch modem & serial ports off */ | 2881 | /* On all machines, switch modem & serial ports off */ |
2875 | np = find_devices("ch-a"); | 2882 | for_each_node_by_name(np, "ch-a") |
2876 | while(np) { | ||
2877 | initial_serial_shutdown(np); | 2883 | initial_serial_shutdown(np); |
2878 | np = np->next; | 2884 | of_node_put(np); |
2879 | } | 2885 | for_each_node_by_name(np, "ch-b") |
2880 | np = find_devices("ch-b"); | ||
2881 | while(np) { | ||
2882 | initial_serial_shutdown(np); | 2886 | initial_serial_shutdown(np); |
2883 | np = np->next; | 2887 | of_node_put(np); |
2884 | } | ||
2885 | } | 2888 | } |
2886 | 2889 | ||
2887 | void __init | 2890 | void __init |
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index 092cef4160a1..22c4ae4c6934 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c | |||
@@ -622,13 +622,14 @@ static void __init init_p2pbridge(void) | |||
622 | 622 | ||
623 | /* XXX it would be better here to identify the specific | 623 | /* XXX it would be better here to identify the specific |
624 | PCI-PCI bridge chip we have. */ | 624 | PCI-PCI bridge chip we have. */ |
625 | if ((p2pbridge = find_devices("pci-bridge")) == 0 | 625 | p2pbridge = of_find_node_by_name(NULL, "pci-bridge"); |
626 | if (p2pbridge == NULL | ||
626 | || p2pbridge->parent == NULL | 627 | || p2pbridge->parent == NULL |
627 | || strcmp(p2pbridge->parent->name, "pci") != 0) | 628 | || strcmp(p2pbridge->parent->name, "pci") != 0) |
628 | return; | 629 | goto done; |
629 | if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) { | 630 | if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) { |
630 | DBG("Can't find PCI infos for PCI<->PCI bridge\n"); | 631 | DBG("Can't find PCI infos for PCI<->PCI bridge\n"); |
631 | return; | 632 | goto done; |
632 | } | 633 | } |
633 | /* Warning: At this point, we have not yet renumbered all busses. | 634 | /* Warning: At this point, we have not yet renumbered all busses. |
634 | * So we must use OF walking to find out hose | 635 | * So we must use OF walking to find out hose |
@@ -636,16 +637,18 @@ static void __init init_p2pbridge(void) | |||
636 | hose = pci_find_hose_for_OF_device(p2pbridge); | 637 | hose = pci_find_hose_for_OF_device(p2pbridge); |
637 | if (!hose) { | 638 | if (!hose) { |
638 | DBG("Can't find hose for PCI<->PCI bridge\n"); | 639 | DBG("Can't find hose for PCI<->PCI bridge\n"); |
639 | return; | 640 | goto done; |
640 | } | 641 | } |
641 | if (early_read_config_word(hose, bus, devfn, | 642 | if (early_read_config_word(hose, bus, devfn, |
642 | PCI_BRIDGE_CONTROL, &val) < 0) { | 643 | PCI_BRIDGE_CONTROL, &val) < 0) { |
643 | printk(KERN_ERR "init_p2pbridge: couldn't read bridge" | 644 | printk(KERN_ERR "init_p2pbridge: couldn't read bridge" |
644 | " control\n"); | 645 | " control\n"); |
645 | return; | 646 | goto done; |
646 | } | 647 | } |
647 | val &= ~PCI_BRIDGE_CTL_MASTER_ABORT; | 648 | val &= ~PCI_BRIDGE_CTL_MASTER_ABORT; |
648 | early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val); | 649 | early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val); |
650 | done: | ||
651 | of_node_put(p2pbridge); | ||
649 | } | 652 | } |
650 | 653 | ||
651 | static void __init init_second_ohare(void) | 654 | static void __init init_second_ohare(void) |
@@ -1199,8 +1202,7 @@ void __init pmac_pcibios_after_init(void) | |||
1199 | } | 1202 | } |
1200 | #endif /* CONFIG_BLK_DEV_IDE */ | 1203 | #endif /* CONFIG_BLK_DEV_IDE */ |
1201 | 1204 | ||
1202 | nd = find_devices("firewire"); | 1205 | for_each_node_by_name(nd, "firewire") { |
1203 | while (nd) { | ||
1204 | if (nd->parent && (device_is_compatible(nd, "pci106b,18") || | 1206 | if (nd->parent && (device_is_compatible(nd, "pci106b,18") || |
1205 | device_is_compatible(nd, "pci106b,30") || | 1207 | device_is_compatible(nd, "pci106b,30") || |
1206 | device_is_compatible(nd, "pci11c1,5811")) | 1208 | device_is_compatible(nd, "pci11c1,5811")) |
@@ -1208,15 +1210,14 @@ void __init pmac_pcibios_after_init(void) | |||
1208 | pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0); | 1210 | pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0); |
1209 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0); | 1211 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0); |
1210 | } | 1212 | } |
1211 | nd = nd->next; | ||
1212 | } | 1213 | } |
1213 | nd = find_devices("ethernet"); | 1214 | of_node_put(nd); |
1214 | while (nd) { | 1215 | for_each_node_by_name(nd, "ethernet") { |
1215 | if (nd->parent && device_is_compatible(nd, "gmac") | 1216 | if (nd->parent && device_is_compatible(nd, "gmac") |
1216 | && device_is_compatible(nd->parent, "uni-north")) | 1217 | && device_is_compatible(nd->parent, "uni-north")) |
1217 | pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0); | 1218 | pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0); |
1218 | nd = nd->next; | ||
1219 | } | 1219 | } |
1220 | of_node_put(nd); | ||
1220 | } | 1221 | } |
1221 | 1222 | ||
1222 | #ifdef CONFIG_PPC32 | 1223 | #ifdef CONFIG_PPC32 |
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index ae37d3e23783..0444e07e8d7a 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -193,8 +193,11 @@ static void pmac_show_cpuinfo(struct seq_file *m) | |||
193 | #ifndef CONFIG_ADB_CUDA | 193 | #ifndef CONFIG_ADB_CUDA |
194 | int find_via_cuda(void) | 194 | int find_via_cuda(void) |
195 | { | 195 | { |
196 | if (!find_devices("via-cuda")) | 196 | struct device_node *dn = of_find_node_by_name(NULL, "via-cuda"); |
197 | |||
198 | if (!dn) | ||
197 | return 0; | 199 | return 0; |
200 | of_node_put(dn); | ||
198 | printk("WARNING ! Your machine is CUDA-based but your kernel\n"); | 201 | printk("WARNING ! Your machine is CUDA-based but your kernel\n"); |
199 | printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n"); | 202 | printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n"); |
200 | return 0; | 203 | return 0; |
@@ -204,8 +207,11 @@ int find_via_cuda(void) | |||
204 | #ifndef CONFIG_ADB_PMU | 207 | #ifndef CONFIG_ADB_PMU |
205 | int find_via_pmu(void) | 208 | int find_via_pmu(void) |
206 | { | 209 | { |
207 | if (!find_devices("via-pmu")) | 210 | struct device_node *dn = of_find_node_by_name(NULL, "via-pmu"); |
211 | |||
212 | if (!dn) | ||
208 | return 0; | 213 | return 0; |
214 | of_node_put(dn); | ||
209 | printk("WARNING ! Your machine is PMU-based but your kernel\n"); | 215 | printk("WARNING ! Your machine is PMU-based but your kernel\n"); |
210 | printk(" wasn't compiled with CONFIG_ADB_PMU option !\n"); | 216 | printk(" wasn't compiled with CONFIG_ADB_PMU option !\n"); |
211 | return 0; | 217 | return 0; |
@@ -225,6 +231,8 @@ static volatile u32 *sysctrl_regs; | |||
225 | 231 | ||
226 | static void __init ohare_init(void) | 232 | static void __init ohare_init(void) |
227 | { | 233 | { |
234 | struct device_node *dn; | ||
235 | |||
228 | /* this area has the CPU identification register | 236 | /* this area has the CPU identification register |
229 | and some registers used by smp boards */ | 237 | and some registers used by smp boards */ |
230 | sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000); | 238 | sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000); |
@@ -234,7 +242,9 @@ static void __init ohare_init(void) | |||
234 | * We assume that we have a PSX memory controller iff | 242 | * We assume that we have a PSX memory controller iff |
235 | * we have an ohare I/O controller. | 243 | * we have an ohare I/O controller. |
236 | */ | 244 | */ |
237 | if (find_devices("ohare") != NULL) { | 245 | dn = of_find_node_by_name(NULL, "ohare"); |
246 | if (dn) { | ||
247 | of_node_put(dn); | ||
238 | if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) { | 248 | if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) { |
239 | if (sysctrl_regs[4] & 0x10) | 249 | if (sysctrl_regs[4] & 0x10) |
240 | sysctrl_regs[4] |= 0x04000020; | 250 | sysctrl_regs[4] |= 0x04000020; |
@@ -343,8 +353,15 @@ static void __init pmac_setup_arch(void) | |||
343 | 353 | ||
344 | #ifdef CONFIG_SMP | 354 | #ifdef CONFIG_SMP |
345 | /* Check for Core99 */ | 355 | /* Check for Core99 */ |
346 | if (find_devices("uni-n") || find_devices("u3") || find_devices("u4")) | 356 | ic = of_find_node_by_name(NULL, "uni-n"); |
357 | if (!ic) | ||
358 | ic = of_find_node_by_name(NULL, "u3"); | ||
359 | if (!ic) | ||
360 | ic = of_find_node_by_name(NULL, "u4"); | ||
361 | if (ic) { | ||
362 | of_node_put(ic); | ||
347 | smp_ops = &core99_smp_ops; | 363 | smp_ops = &core99_smp_ops; |
364 | } | ||
348 | #ifdef CONFIG_PPC32 | 365 | #ifdef CONFIG_PPC32 |
349 | else | 366 | else |
350 | smp_ops = &psurge_smp_ops; | 367 | smp_ops = &psurge_smp_ops; |
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index 20f328678fd1..6f32c4eca6e5 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -264,6 +264,7 @@ static void __init psurge_quad_init(void) | |||
264 | static int __init smp_psurge_probe(void) | 264 | static int __init smp_psurge_probe(void) |
265 | { | 265 | { |
266 | int i, ncpus; | 266 | int i, ncpus; |
267 | struct device_node *dn; | ||
267 | 268 | ||
268 | /* We don't do SMP on the PPC601 -- paulus */ | 269 | /* We don't do SMP on the PPC601 -- paulus */ |
269 | if (PVR_VER(mfspr(SPRN_PVR)) == 1) | 270 | if (PVR_VER(mfspr(SPRN_PVR)) == 1) |
@@ -279,8 +280,10 @@ static int __init smp_psurge_probe(void) | |||
279 | * in the hammerhead memory controller in the case of the | 280 | * in the hammerhead memory controller in the case of the |
280 | * dual-cpu powersurge board. -- paulus. | 281 | * dual-cpu powersurge board. -- paulus. |
281 | */ | 282 | */ |
282 | if (find_devices("hammerhead") == NULL) | 283 | dn = of_find_node_by_name(NULL, "hammerhead"); |
284 | if (dn == NULL) | ||
283 | return 1; | 285 | return 1; |
286 | of_node_put(dn); | ||
284 | 287 | ||
285 | hhead_base = ioremap(HAMMERHEAD_BASE, 0x800); | 288 | hhead_base = ioremap(HAMMERHEAD_BASE, 0x800); |
286 | quad_base = ioremap(PSURGE_QUAD_REG_ADDR, 1024); | 289 | quad_base = ioremap(PSURGE_QUAD_REG_ADDR, 1024); |