aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/prom.c19
-rw-r--r--arch/powerpc/platforms/chrp/setup.c6
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c3
-rw-r--r--arch/powerpc/platforms/powermac/setup.c5
-rw-r--r--drivers/macintosh/via-pmu.c5
-rw-r--r--include/asm-powerpc/prom.h1
6 files changed, 13 insertions, 26 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 17c41fefecf2..860c88b2f6d1 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1091,25 +1091,6 @@ struct device_node *find_devices(const char *name)
1091} 1091}
1092EXPORT_SYMBOL(find_devices); 1092EXPORT_SYMBOL(find_devices);
1093 1093
1094/**
1095 * Construct and return a list of the device_nodes with a given type.
1096 */
1097struct device_node *find_type_devices(const char *type)
1098{
1099 struct device_node *head, **prevp, *np;
1100
1101 prevp = &head;
1102 for (np = allnodes; np != 0; np = np->allnext) {
1103 if (np->type != 0 && strcasecmp(np->type, type) == 0) {
1104 *prevp = np;
1105 prevp = &np->next;
1106 }
1107 }
1108 *prevp = NULL;
1109 return head;
1110}
1111EXPORT_SYMBOL(find_type_devices);
1112
1113/** Checks if the given "compat" string matches one of the strings in 1094/** Checks if the given "compat" string matches one of the strings in
1114 * the device's "compatible" property 1095 * the device's "compatible" property
1115 */ 1096 */
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index e46c4d4a5804..9c1b231b1ff9 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -226,12 +226,12 @@ static void __init pegasos_set_l2cr(void)
226 return; 226 return;
227 227
228 /* Enable L2 cache if needed */ 228 /* Enable L2 cache if needed */
229 np = find_type_devices("cpu"); 229 np = of_find_node_by_type(NULL, "cpu");
230 if (np != NULL) { 230 if (np != NULL) {
231 const unsigned int *l2cr = of_get_property(np, "l2cr", NULL); 231 const unsigned int *l2cr = of_get_property(np, "l2cr", NULL);
232 if (l2cr == NULL) { 232 if (l2cr == NULL) {
233 printk ("Pegasos l2cr : no cpu l2cr property found\n"); 233 printk ("Pegasos l2cr : no cpu l2cr property found\n");
234 return; 234 goto out;
235 } 235 }
236 if (!((*l2cr) & 0x80000000)) { 236 if (!((*l2cr) & 0x80000000)) {
237 printk ("Pegasos l2cr : L2 cache was not active, " 237 printk ("Pegasos l2cr : L2 cache was not active, "
@@ -240,6 +240,8 @@ static void __init pegasos_set_l2cr(void)
240 _set_L2CR((*l2cr) | 0x80000000); 240 _set_L2CR((*l2cr) | 0x80000000);
241 } 241 }
242 } 242 }
243out:
244 of_node_put(np);
243} 245}
244 246
245static void briq_restart(char *cmd) 247static void briq_restart(char *cmd)
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 76eda9fcd1aa..8943a9456bb7 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -658,7 +658,7 @@ static int __init pmac_cpufreq_setup(void)
658 return 0; 658 return 0;
659 659
660 /* Assume only one CPU */ 660 /* Assume only one CPU */
661 cpunode = find_type_devices("cpu"); 661 cpunode = of_find_node_by_type(NULL, "cpu");
662 if (!cpunode) 662 if (!cpunode)
663 goto out; 663 goto out;
664 664
@@ -708,6 +708,7 @@ static int __init pmac_cpufreq_setup(void)
708 else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000) 708 else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000)
709 pmac_cpufreq_init_750FX(cpunode); 709 pmac_cpufreq_init_750FX(cpunode);
710out: 710out:
711 of_node_put(cpunode);
711 if (set_speed_proc == NULL) 712 if (set_speed_proc == NULL)
712 return -ENODEV; 713 return -ENODEV;
713 714
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 8c96f2461e9a..ae37d3e23783 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -250,9 +250,9 @@ static void __init l2cr_init(void)
250{ 250{
251 /* Checks "l2cr-value" property in the registry */ 251 /* Checks "l2cr-value" property in the registry */
252 if (cpu_has_feature(CPU_FTR_L2CR)) { 252 if (cpu_has_feature(CPU_FTR_L2CR)) {
253 struct device_node *np = find_devices("cpus"); 253 struct device_node *np = of_find_node_by_name(NULL, "cpus");
254 if (np == 0) 254 if (np == 0)
255 np = find_type_devices("cpu"); 255 np = of_find_node_by_type(NULL, "cpu");
256 if (np != 0) { 256 if (np != 0) {
257 const unsigned int *l2cr = 257 const unsigned int *l2cr =
258 of_get_property(np, "l2cr-value", NULL); 258 of_get_property(np, "l2cr-value", NULL);
@@ -262,6 +262,7 @@ static void __init l2cr_init(void)
262 _set_L2CR(0); 262 _set_L2CR(0);
263 _set_L2CR(ppc_override_l2cr_value); 263 _set_L2CR(ppc_override_l2cr_value);
264 } 264 }
265 of_node_put(np);
265 } 266 }
266 } 267 }
267 268
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 75623fd18792..7b7db5db50dc 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -319,10 +319,13 @@ int __init find_via_pmu(void)
319 else if (device_is_compatible(vias->parent, "Keylargo") 319 else if (device_is_compatible(vias->parent, "Keylargo")
320 || device_is_compatible(vias->parent, "K2-Keylargo")) { 320 || device_is_compatible(vias->parent, "K2-Keylargo")) {
321 struct device_node *gpiop; 321 struct device_node *gpiop;
322 struct device_node *adbp;
322 u64 gaddr = OF_BAD_ADDR; 323 u64 gaddr = OF_BAD_ADDR;
323 324
324 pmu_kind = PMU_KEYLARGO_BASED; 325 pmu_kind = PMU_KEYLARGO_BASED;
325 pmu_has_adb = (find_type_devices("adb") != NULL); 326 adbp = of_find_node_by_type(NULL, "adb");
327 pmu_has_adb = (adbp != NULL);
328 of_node_put(adbp);
326 pmu_intr_mask = PMU_INT_PCEJECT | 329 pmu_intr_mask = PMU_INT_PCEJECT |
327 PMU_INT_SNDBRT | 330 PMU_INT_SNDBRT |
328 PMU_INT_ADB | 331 PMU_INT_ADB |
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index a070defc4438..990489cac9b9 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -114,7 +114,6 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e
114 114
115/* OBSOLETE: Old style node lookup */ 115/* OBSOLETE: Old style node lookup */
116extern struct device_node *find_devices(const char *name); 116extern struct device_node *find_devices(const char *name);
117extern struct device_node *find_type_devices(const char *type);
118 117
119/* New style node lookup */ 118/* New style node lookup */
120extern struct device_node *of_find_node_by_name(struct device_node *from, 119extern struct device_node *of_find_node_by_name(struct device_node *from,