aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/devices.c
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2010-10-08 17:18:11 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-10-09 04:33:34 -0400
commit8d1255627d4ce9cb4b9d0a1c44b6c18d92e84a99 (patch)
tree0167da953304dbabc87ab871368bcc3c10660fa8 /arch/sparc/kernel/devices.c
parent4e13efc99106723960a27e55f560028bced5076d (diff)
of/sparc: convert various prom_* functions to use phandle
Rather than passing around ints everywhere, use the phandle type where appropriate for the various functions that talk to the PROM. Signed-off-by: Andres Salomon <dilinger@queued.net> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch/sparc/kernel/devices.c')
-rw-r--r--arch/sparc/kernel/devices.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index 62dc7a021413..d2eddd6647cd 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -31,9 +31,9 @@ static char *cpu_mid_prop(void)
31 return "mid"; 31 return "mid";
32} 32}
33 33
34static int check_cpu_node(int nd, int *cur_inst, 34static int check_cpu_node(phandle nd, int *cur_inst,
35 int (*compare)(int, int, void *), void *compare_arg, 35 int (*compare)(phandle, int, void *), void *compare_arg,
36 int *prom_node, int *mid) 36 phandle *prom_node, int *mid)
37{ 37{
38 if (!compare(nd, *cur_inst, compare_arg)) { 38 if (!compare(nd, *cur_inst, compare_arg)) {
39 if (prom_node) 39 if (prom_node)
@@ -51,8 +51,8 @@ static int check_cpu_node(int nd, int *cur_inst,
51 return -ENODEV; 51 return -ENODEV;
52} 52}
53 53
54static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg, 54static int __cpu_find_by(int (*compare)(phandle, int, void *),
55 int *prom_node, int *mid) 55 void *compare_arg, phandle *prom_node, int *mid)
56{ 56{
57 struct device_node *dp; 57 struct device_node *dp;
58 int cur_inst; 58 int cur_inst;
@@ -71,7 +71,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg,
71 return -ENODEV; 71 return -ENODEV;
72} 72}
73 73
74static int cpu_instance_compare(int nd, int instance, void *_arg) 74static int cpu_instance_compare(phandle nd, int instance, void *_arg)
75{ 75{
76 int desired_instance = (int) _arg; 76 int desired_instance = (int) _arg;
77 77
@@ -80,13 +80,13 @@ static int cpu_instance_compare(int nd, int instance, void *_arg)
80 return -ENODEV; 80 return -ENODEV;
81} 81}
82 82
83int cpu_find_by_instance(int instance, int *prom_node, int *mid) 83int cpu_find_by_instance(int instance, phandle *prom_node, int *mid)
84{ 84{
85 return __cpu_find_by(cpu_instance_compare, (void *)instance, 85 return __cpu_find_by(cpu_instance_compare, (void *)instance,
86 prom_node, mid); 86 prom_node, mid);
87} 87}
88 88
89static int cpu_mid_compare(int nd, int instance, void *_arg) 89static int cpu_mid_compare(phandle nd, int instance, void *_arg)
90{ 90{
91 int desired_mid = (int) _arg; 91 int desired_mid = (int) _arg;
92 int this_mid; 92 int this_mid;
@@ -98,7 +98,7 @@ static int cpu_mid_compare(int nd, int instance, void *_arg)
98 return -ENODEV; 98 return -ENODEV;
99} 99}
100 100
101int cpu_find_by_mid(int mid, int *prom_node) 101int cpu_find_by_mid(int mid, phandle *prom_node)
102{ 102{
103 return __cpu_find_by(cpu_mid_compare, (void *)mid, 103 return __cpu_find_by(cpu_mid_compare, (void *)mid,
104 prom_node, NULL); 104 prom_node, NULL);
@@ -108,7 +108,7 @@ int cpu_find_by_mid(int mid, int *prom_node)
108 * address (0-3). This gives us the true hardware mid, which might have 108 * address (0-3). This gives us the true hardware mid, which might have
109 * some other bits set. On 4d hardware and software mids are the same. 109 * some other bits set. On 4d hardware and software mids are the same.
110 */ 110 */
111int cpu_get_hwmid(int prom_node) 111int cpu_get_hwmid(phandle prom_node)
112{ 112{
113 return prom_getintdefault(prom_node, cpu_mid_prop(), -ENODEV); 113 return prom_getintdefault(prom_node, cpu_mid_prop(), -ENODEV);
114} 114}
@@ -119,7 +119,8 @@ void __init device_scan(void)
119 119
120#ifndef CONFIG_SMP 120#ifndef CONFIG_SMP
121 { 121 {
122 int err, cpu_node; 122 phandle cpu_node;
123 int err;
123 err = cpu_find_by_instance(0, &cpu_node, NULL); 124 err = cpu_find_by_instance(0, &cpu_node, NULL);
124 if (err) { 125 if (err) {
125 /* Probably a sun4e, Sun is trying to trick us ;-) */ 126 /* Probably a sun4e, Sun is trying to trick us ;-) */