aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/devices.c')
-rw-r--r--arch/sparc/kernel/devices.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index adba9dfee35e..af90a5f9ab57 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -15,6 +15,7 @@
15 15
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/oplib.h> 17#include <asm/oplib.h>
18#include <asm/prom.h>
18#include <asm/smp.h> 19#include <asm/smp.h>
19#include <asm/system.h> 20#include <asm/system.h>
20#include <asm/cpudata.h> 21#include <asm/cpudata.h>
@@ -34,12 +35,6 @@ static int check_cpu_node(int nd, int *cur_inst,
34 int (*compare)(int, int, void *), void *compare_arg, 35 int (*compare)(int, int, void *), void *compare_arg,
35 int *prom_node, int *mid) 36 int *prom_node, int *mid)
36{ 37{
37 char node_str[128];
38
39 prom_getstring(nd, "device_type", node_str, sizeof(node_str));
40 if (strcmp(node_str, "cpu"))
41 return -ENODEV;
42
43 if (!compare(nd, *cur_inst, compare_arg)) { 38 if (!compare(nd, *cur_inst, compare_arg)) {
44 if (prom_node) 39 if (prom_node)
45 *prom_node = nd; 40 *prom_node = nd;
@@ -59,20 +54,14 @@ static int check_cpu_node(int nd, int *cur_inst,
59static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg, 54static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg,
60 int *prom_node, int *mid) 55 int *prom_node, int *mid)
61{ 56{
62 int nd, cur_inst, err; 57 struct device_node *dp;
58 int cur_inst;
63 59
64 nd = prom_root_node;
65 cur_inst = 0; 60 cur_inst = 0;
66 61 for_each_node_by_type(dp, "cpu") {
67 err = check_cpu_node(nd, &cur_inst, compare, compare_arg, 62 int err = check_cpu_node(dp->node, &cur_inst,
68 prom_node, mid); 63 compare, compare_arg,
69 if (!err) 64 prom_node, mid);
70 return 0;
71
72 nd = prom_getchild(nd);
73 while ((nd = prom_getsibling(nd)) != 0) {
74 err = check_cpu_node(nd, &cur_inst, compare, compare_arg,
75 prom_node, mid);
76 if (!err) 65 if (!err)
77 return 0; 66 return 0;
78 } 67 }