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/platforms/powermac/feature.c | |
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/platforms/powermac/feature.c')
-rw-r--r-- | arch/powerpc/platforms/powermac/feature.c | 45 |
1 files changed, 24 insertions, 21 deletions
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 |