diff options
author | Andres Salomon <dilinger@queued.net> | 2010-10-08 17:18:11 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-10-09 04:33:34 -0400 |
commit | 8d1255627d4ce9cb4b9d0a1c44b6c18d92e84a99 (patch) | |
tree | 0167da953304dbabc87ab871368bcc3c10660fa8 /arch/sparc/prom | |
parent | 4e13efc99106723960a27e55f560028bced5076d (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/prom')
-rw-r--r-- | arch/sparc/prom/init_32.c | 2 | ||||
-rw-r--r-- | arch/sparc/prom/init_64.c | 4 | ||||
-rw-r--r-- | arch/sparc/prom/memory.c | 3 | ||||
-rw-r--r-- | arch/sparc/prom/misc_64.c | 6 | ||||
-rw-r--r-- | arch/sparc/prom/ranges.c | 6 | ||||
-rw-r--r-- | arch/sparc/prom/tree_32.c | 58 | ||||
-rw-r--r-- | arch/sparc/prom/tree_64.c | 62 |
7 files changed, 73 insertions, 68 deletions
diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c index ccb36c7f9b8c..d342dba4dd54 100644 --- a/arch/sparc/prom/init_32.c +++ b/arch/sparc/prom/init_32.c | |||
@@ -20,7 +20,7 @@ enum prom_major_version prom_vers; | |||
20 | unsigned int prom_rev, prom_prev; | 20 | unsigned int prom_rev, prom_prev; |
21 | 21 | ||
22 | /* The root node of the prom device tree. */ | 22 | /* The root node of the prom device tree. */ |
23 | int prom_root_node; | 23 | phandle prom_root_node; |
24 | EXPORT_SYMBOL(prom_root_node); | 24 | EXPORT_SYMBOL(prom_root_node); |
25 | 25 | ||
26 | /* Pointer to the device tree operations structure. */ | 26 | /* Pointer to the device tree operations structure. */ |
diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c index 7b00f89490a4..3ff911e7d25b 100644 --- a/arch/sparc/prom/init_64.c +++ b/arch/sparc/prom/init_64.c | |||
@@ -19,7 +19,7 @@ char prom_version[80]; | |||
19 | 19 | ||
20 | /* The root node of the prom device tree. */ | 20 | /* The root node of the prom device tree. */ |
21 | int prom_stdin, prom_stdout; | 21 | int prom_stdin, prom_stdout; |
22 | int prom_chosen_node; | 22 | phandle prom_chosen_node; |
23 | 23 | ||
24 | /* You must call prom_init() before you attempt to use any of the | 24 | /* You must call prom_init() before you attempt to use any of the |
25 | * routines in the prom library. It returns 0 on success, 1 on | 25 | * routines in the prom library. It returns 0 on success, 1 on |
@@ -30,7 +30,7 @@ extern void prom_cif_init(void *, void *); | |||
30 | 30 | ||
31 | void __init prom_init(void *cif_handler, void *cif_stack) | 31 | void __init prom_init(void *cif_handler, void *cif_stack) |
32 | { | 32 | { |
33 | int node; | 33 | phandle node; |
34 | 34 | ||
35 | prom_cif_init(cif_handler, cif_stack); | 35 | prom_cif_init(cif_handler, cif_stack); |
36 | 36 | ||
diff --git a/arch/sparc/prom/memory.c b/arch/sparc/prom/memory.c index fac7899a29c3..3f263a64857d 100644 --- a/arch/sparc/prom/memory.c +++ b/arch/sparc/prom/memory.c | |||
@@ -31,7 +31,8 @@ static int __init prom_meminit_v0(void) | |||
31 | static int __init prom_meminit_v2(void) | 31 | static int __init prom_meminit_v2(void) |
32 | { | 32 | { |
33 | struct linux_prom_registers reg[64]; | 33 | struct linux_prom_registers reg[64]; |
34 | int node, size, num_ents, i; | 34 | phandle node; |
35 | int size, num_ents, i; | ||
35 | 36 | ||
36 | node = prom_searchsiblings(prom_getchild(prom_root_node), "memory"); | 37 | node = prom_searchsiblings(prom_getchild(prom_root_node), "memory"); |
37 | size = prom_getproperty(node, "available", (char *) reg, sizeof(reg)); | 38 | size = prom_getproperty(node, "available", (char *) reg, sizeof(reg)); |
diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c index 6cb1581d6aef..d24bc44e361e 100644 --- a/arch/sparc/prom/misc_64.c +++ b/arch/sparc/prom/misc_64.c | |||
@@ -183,7 +183,8 @@ unsigned char prom_get_idprom(char *idbuf, int num_bytes) | |||
183 | 183 | ||
184 | int prom_get_mmu_ihandle(void) | 184 | int prom_get_mmu_ihandle(void) |
185 | { | 185 | { |
186 | int node, ret; | 186 | phandle node; |
187 | int ret; | ||
187 | 188 | ||
188 | if (prom_mmu_ihandle_cache != 0) | 189 | if (prom_mmu_ihandle_cache != 0) |
189 | return prom_mmu_ihandle_cache; | 190 | return prom_mmu_ihandle_cache; |
@@ -201,7 +202,8 @@ int prom_get_mmu_ihandle(void) | |||
201 | static int prom_get_memory_ihandle(void) | 202 | static int prom_get_memory_ihandle(void) |
202 | { | 203 | { |
203 | static int memory_ihandle_cache; | 204 | static int memory_ihandle_cache; |
204 | int node, ret; | 205 | phandle node; |
206 | int ret; | ||
205 | 207 | ||
206 | if (memory_ihandle_cache != 0) | 208 | if (memory_ihandle_cache != 0) |
207 | return memory_ihandle_cache; | 209 | return memory_ihandle_cache; |
diff --git a/arch/sparc/prom/ranges.c b/arch/sparc/prom/ranges.c index aeff43e44e45..541fc829c207 100644 --- a/arch/sparc/prom/ranges.c +++ b/arch/sparc/prom/ranges.c | |||
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(prom_apply_obio_ranges); | |||
68 | 68 | ||
69 | void __init prom_ranges_init(void) | 69 | void __init prom_ranges_init(void) |
70 | { | 70 | { |
71 | int node, obio_node; | 71 | phandle node, obio_node; |
72 | int success; | 72 | int success; |
73 | 73 | ||
74 | num_obio_ranges = 0; | 74 | num_obio_ranges = 0; |
@@ -89,8 +89,8 @@ void __init prom_ranges_init(void) | |||
89 | prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); | 89 | prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); |
90 | } | 90 | } |
91 | 91 | ||
92 | void | 92 | void prom_apply_generic_ranges(phandle node, phandle parent, |
93 | prom_apply_generic_ranges (int node, int parent, struct linux_prom_registers *regs, int nregs) | 93 | struct linux_prom_registers *regs, int nregs) |
94 | { | 94 | { |
95 | int success; | 95 | int success; |
96 | int num_ranges; | 96 | int num_ranges; |
diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c index b21592f8e3fe..63e08e149774 100644 --- a/arch/sparc/prom/tree_32.c +++ b/arch/sparc/prom/tree_32.c | |||
@@ -20,10 +20,10 @@ extern void restore_current(void); | |||
20 | static char promlib_buf[128]; | 20 | static char promlib_buf[128]; |
21 | 21 | ||
22 | /* Internal version of prom_getchild that does not alter return values. */ | 22 | /* Internal version of prom_getchild that does not alter return values. */ |
23 | int __prom_getchild(int node) | 23 | phandle __prom_getchild(phandle node) |
24 | { | 24 | { |
25 | unsigned long flags; | 25 | unsigned long flags; |
26 | int cnode; | 26 | phandle cnode; |
27 | 27 | ||
28 | spin_lock_irqsave(&prom_lock, flags); | 28 | spin_lock_irqsave(&prom_lock, flags); |
29 | cnode = prom_nodeops->no_child(node); | 29 | cnode = prom_nodeops->no_child(node); |
@@ -36,9 +36,9 @@ int __prom_getchild(int node) | |||
36 | /* Return the child of node 'node' or zero if no this node has no | 36 | /* Return the child of node 'node' or zero if no this node has no |
37 | * direct descendent. | 37 | * direct descendent. |
38 | */ | 38 | */ |
39 | int prom_getchild(int node) | 39 | phandle prom_getchild(phandle node) |
40 | { | 40 | { |
41 | int cnode; | 41 | phandle cnode; |
42 | 42 | ||
43 | if (node == -1) | 43 | if (node == -1) |
44 | return 0; | 44 | return 0; |
@@ -52,10 +52,10 @@ int prom_getchild(int node) | |||
52 | EXPORT_SYMBOL(prom_getchild); | 52 | EXPORT_SYMBOL(prom_getchild); |
53 | 53 | ||
54 | /* Internal version of prom_getsibling that does not alter return values. */ | 54 | /* Internal version of prom_getsibling that does not alter return values. */ |
55 | int __prom_getsibling(int node) | 55 | phandle __prom_getsibling(phandle node) |
56 | { | 56 | { |
57 | unsigned long flags; | 57 | unsigned long flags; |
58 | int cnode; | 58 | phandle cnode; |
59 | 59 | ||
60 | spin_lock_irqsave(&prom_lock, flags); | 60 | spin_lock_irqsave(&prom_lock, flags); |
61 | cnode = prom_nodeops->no_nextnode(node); | 61 | cnode = prom_nodeops->no_nextnode(node); |
@@ -68,9 +68,9 @@ int __prom_getsibling(int node) | |||
68 | /* Return the next sibling of node 'node' or zero if no more siblings | 68 | /* Return the next sibling of node 'node' or zero if no more siblings |
69 | * at this level of depth in the tree. | 69 | * at this level of depth in the tree. |
70 | */ | 70 | */ |
71 | int prom_getsibling(int node) | 71 | phandle prom_getsibling(phandle node) |
72 | { | 72 | { |
73 | int sibnode; | 73 | phandle sibnode; |
74 | 74 | ||
75 | if (node == -1) | 75 | if (node == -1) |
76 | return 0; | 76 | return 0; |
@@ -86,7 +86,7 @@ EXPORT_SYMBOL(prom_getsibling); | |||
86 | /* Return the length in bytes of property 'prop' at node 'node'. | 86 | /* Return the length in bytes of property 'prop' at node 'node'. |
87 | * Return -1 on error. | 87 | * Return -1 on error. |
88 | */ | 88 | */ |
89 | int prom_getproplen(int node, const char *prop) | 89 | int prom_getproplen(phandle node, const char *prop) |
90 | { | 90 | { |
91 | int ret; | 91 | int ret; |
92 | unsigned long flags; | 92 | unsigned long flags; |
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(prom_getproplen); | |||
106 | * 'buffer' which has a size of 'bufsize'. If the acquisition | 106 | * 'buffer' which has a size of 'bufsize'. If the acquisition |
107 | * was successful the length will be returned, else -1 is returned. | 107 | * was successful the length will be returned, else -1 is returned. |
108 | */ | 108 | */ |
109 | int prom_getproperty(int node, const char *prop, char *buffer, int bufsize) | 109 | int prom_getproperty(phandle node, const char *prop, char *buffer, int bufsize) |
110 | { | 110 | { |
111 | int plen, ret; | 111 | int plen, ret; |
112 | unsigned long flags; | 112 | unsigned long flags; |
@@ -126,7 +126,7 @@ EXPORT_SYMBOL(prom_getproperty); | |||
126 | /* Acquire an integer property and return its value. Returns -1 | 126 | /* Acquire an integer property and return its value. Returns -1 |
127 | * on failure. | 127 | * on failure. |
128 | */ | 128 | */ |
129 | int prom_getint(int node, char *prop) | 129 | int prom_getint(phandle node, char *prop) |
130 | { | 130 | { |
131 | static int intprop; | 131 | static int intprop; |
132 | 132 | ||
@@ -140,7 +140,7 @@ EXPORT_SYMBOL(prom_getint); | |||
140 | /* Acquire an integer property, upon error return the passed default | 140 | /* Acquire an integer property, upon error return the passed default |
141 | * integer. | 141 | * integer. |
142 | */ | 142 | */ |
143 | int prom_getintdefault(int node, char *property, int deflt) | 143 | int prom_getintdefault(phandle node, char *property, int deflt) |
144 | { | 144 | { |
145 | int retval; | 145 | int retval; |
146 | 146 | ||
@@ -152,7 +152,7 @@ int prom_getintdefault(int node, char *property, int deflt) | |||
152 | EXPORT_SYMBOL(prom_getintdefault); | 152 | EXPORT_SYMBOL(prom_getintdefault); |
153 | 153 | ||
154 | /* Acquire a boolean property, 1=TRUE 0=FALSE. */ | 154 | /* Acquire a boolean property, 1=TRUE 0=FALSE. */ |
155 | int prom_getbool(int node, char *prop) | 155 | int prom_getbool(phandle node, char *prop) |
156 | { | 156 | { |
157 | int retval; | 157 | int retval; |
158 | 158 | ||
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(prom_getbool); | |||
166 | * string on error. The char pointer is the user supplied string | 166 | * string on error. The char pointer is the user supplied string |
167 | * buffer. | 167 | * buffer. |
168 | */ | 168 | */ |
169 | void prom_getstring(int node, char *prop, char *user_buf, int ubuf_size) | 169 | void prom_getstring(phandle node, char *prop, char *user_buf, int ubuf_size) |
170 | { | 170 | { |
171 | int len; | 171 | int len; |
172 | 172 | ||
@@ -180,7 +180,7 @@ EXPORT_SYMBOL(prom_getstring); | |||
180 | /* Does the device at node 'node' have name 'name'? | 180 | /* Does the device at node 'node' have name 'name'? |
181 | * YES = 1 NO = 0 | 181 | * YES = 1 NO = 0 |
182 | */ | 182 | */ |
183 | int prom_nodematch(int node, char *name) | 183 | int prom_nodematch(phandle node, char *name) |
184 | { | 184 | { |
185 | int error; | 185 | int error; |
186 | 186 | ||
@@ -194,10 +194,11 @@ int prom_nodematch(int node, char *name) | |||
194 | /* Search siblings at 'node_start' for a node with name | 194 | /* Search siblings at 'node_start' for a node with name |
195 | * 'nodename'. Return node if successful, zero if not. | 195 | * 'nodename'. Return node if successful, zero if not. |
196 | */ | 196 | */ |
197 | int prom_searchsiblings(int node_start, char *nodename) | 197 | phandle prom_searchsiblings(phandle node_start, char *nodename) |
198 | { | 198 | { |
199 | 199 | ||
200 | int thisnode, error; | 200 | phandle thisnode; |
201 | int error; | ||
201 | 202 | ||
202 | for(thisnode = node_start; thisnode; | 203 | for(thisnode = node_start; thisnode; |
203 | thisnode=prom_getsibling(thisnode)) { | 204 | thisnode=prom_getsibling(thisnode)) { |
@@ -213,7 +214,7 @@ int prom_searchsiblings(int node_start, char *nodename) | |||
213 | EXPORT_SYMBOL(prom_searchsiblings); | 214 | EXPORT_SYMBOL(prom_searchsiblings); |
214 | 215 | ||
215 | /* Interal version of nextprop that does not alter return values. */ | 216 | /* Interal version of nextprop that does not alter return values. */ |
216 | char * __prom_nextprop(int node, char * oprop) | 217 | char *__prom_nextprop(phandle node, char * oprop) |
217 | { | 218 | { |
218 | unsigned long flags; | 219 | unsigned long flags; |
219 | char *prop; | 220 | char *prop; |
@@ -228,7 +229,7 @@ char * __prom_nextprop(int node, char * oprop) | |||
228 | 229 | ||
229 | /* Return the first property name for node 'node'. */ | 230 | /* Return the first property name for node 'node'. */ |
230 | /* buffer is unused argument, but as v9 uses it, we need to have the same interface */ | 231 | /* buffer is unused argument, but as v9 uses it, we need to have the same interface */ |
231 | char * prom_firstprop(int node, char *bufer) | 232 | char *prom_firstprop(phandle node, char *bufer) |
232 | { | 233 | { |
233 | if (node == 0 || node == -1) | 234 | if (node == 0 || node == -1) |
234 | return ""; | 235 | return ""; |
@@ -241,7 +242,7 @@ EXPORT_SYMBOL(prom_firstprop); | |||
241 | * at node 'node' . Returns empty string if no more | 242 | * at node 'node' . Returns empty string if no more |
242 | * property types for this node. | 243 | * property types for this node. |
243 | */ | 244 | */ |
244 | char * prom_nextprop(int node, char *oprop, char *buffer) | 245 | char *prom_nextprop(phandle node, char *oprop, char *buffer) |
245 | { | 246 | { |
246 | if (node == 0 || node == -1) | 247 | if (node == 0 || node == -1) |
247 | return ""; | 248 | return ""; |
@@ -250,11 +251,11 @@ char * prom_nextprop(int node, char *oprop, char *buffer) | |||
250 | } | 251 | } |
251 | EXPORT_SYMBOL(prom_nextprop); | 252 | EXPORT_SYMBOL(prom_nextprop); |
252 | 253 | ||
253 | int prom_finddevice(char *name) | 254 | phandle prom_finddevice(char *name) |
254 | { | 255 | { |
255 | char nbuf[128]; | 256 | char nbuf[128]; |
256 | char *s = name, *d; | 257 | char *s = name, *d; |
257 | int node = prom_root_node, node2; | 258 | phandle node = prom_root_node, node2; |
258 | unsigned int which_io, phys_addr; | 259 | unsigned int which_io, phys_addr; |
259 | struct linux_prom_registers reg[PROMREG_MAX]; | 260 | struct linux_prom_registers reg[PROMREG_MAX]; |
260 | 261 | ||
@@ -298,7 +299,7 @@ int prom_finddevice(char *name) | |||
298 | } | 299 | } |
299 | EXPORT_SYMBOL(prom_finddevice); | 300 | EXPORT_SYMBOL(prom_finddevice); |
300 | 301 | ||
301 | int prom_node_has_property(int node, char *prop) | 302 | int prom_node_has_property(phandle node, char *prop) |
302 | { | 303 | { |
303 | char *current_property = ""; | 304 | char *current_property = ""; |
304 | 305 | ||
@@ -314,7 +315,7 @@ EXPORT_SYMBOL(prom_node_has_property); | |||
314 | /* Set property 'pname' at node 'node' to value 'value' which has a length | 315 | /* Set property 'pname' at node 'node' to value 'value' which has a length |
315 | * of 'size' bytes. Return the number of bytes the prom accepted. | 316 | * of 'size' bytes. Return the number of bytes the prom accepted. |
316 | */ | 317 | */ |
317 | int prom_setprop(int node, const char *pname, char *value, int size) | 318 | int prom_setprop(phandle node, const char *pname, char *value, int size) |
318 | { | 319 | { |
319 | unsigned long flags; | 320 | unsigned long flags; |
320 | int ret; | 321 | int ret; |
@@ -329,9 +330,9 @@ int prom_setprop(int node, const char *pname, char *value, int size) | |||
329 | } | 330 | } |
330 | EXPORT_SYMBOL(prom_setprop); | 331 | EXPORT_SYMBOL(prom_setprop); |
331 | 332 | ||
332 | int prom_inst2pkg(int inst) | 333 | phandle prom_inst2pkg(int inst) |
333 | { | 334 | { |
334 | int node; | 335 | phandle node; |
335 | unsigned long flags; | 336 | unsigned long flags; |
336 | 337 | ||
337 | spin_lock_irqsave(&prom_lock, flags); | 338 | spin_lock_irqsave(&prom_lock, flags); |
@@ -345,9 +346,10 @@ int prom_inst2pkg(int inst) | |||
345 | /* Return 'node' assigned to a particular prom 'path' | 346 | /* Return 'node' assigned to a particular prom 'path' |
346 | * FIXME: Should work for v0 as well | 347 | * FIXME: Should work for v0 as well |
347 | */ | 348 | */ |
348 | int prom_pathtoinode(char *path) | 349 | phandle prom_pathtoinode(char *path) |
349 | { | 350 | { |
350 | int node, inst; | 351 | phandle node; |
352 | int inst; | ||
351 | 353 | ||
352 | inst = prom_devopen (path); | 354 | inst = prom_devopen (path); |
353 | if (inst == -1) return 0; | 355 | if (inst == -1) return 0; |
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c index 9d3f9137a43a..691be68932f8 100644 --- a/arch/sparc/prom/tree_64.c +++ b/arch/sparc/prom/tree_64.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <asm/oplib.h> | 16 | #include <asm/oplib.h> |
17 | #include <asm/ldc.h> | 17 | #include <asm/ldc.h> |
18 | 18 | ||
19 | static int prom_node_to_node(const char *type, int node) | 19 | static phandle prom_node_to_node(const char *type, phandle node) |
20 | { | 20 | { |
21 | unsigned long args[5]; | 21 | unsigned long args[5]; |
22 | 22 | ||
@@ -28,20 +28,20 @@ static int prom_node_to_node(const char *type, int node) | |||
28 | 28 | ||
29 | p1275_cmd_direct(args); | 29 | p1275_cmd_direct(args); |
30 | 30 | ||
31 | return (int) args[4]; | 31 | return (phandle) args[4]; |
32 | } | 32 | } |
33 | 33 | ||
34 | /* Return the child of node 'node' or zero if no this node has no | 34 | /* Return the child of node 'node' or zero if no this node has no |
35 | * direct descendent. | 35 | * direct descendent. |
36 | */ | 36 | */ |
37 | inline int __prom_getchild(int node) | 37 | inline phandle __prom_getchild(phandle node) |
38 | { | 38 | { |
39 | return prom_node_to_node("child", node); | 39 | return prom_node_to_node("child", node); |
40 | } | 40 | } |
41 | 41 | ||
42 | inline int prom_getchild(int node) | 42 | inline phandle prom_getchild(phandle node) |
43 | { | 43 | { |
44 | int cnode; | 44 | phandle cnode; |
45 | 45 | ||
46 | if (node == -1) | 46 | if (node == -1) |
47 | return 0; | 47 | return 0; |
@@ -52,9 +52,9 @@ inline int prom_getchild(int node) | |||
52 | } | 52 | } |
53 | EXPORT_SYMBOL(prom_getchild); | 53 | EXPORT_SYMBOL(prom_getchild); |
54 | 54 | ||
55 | inline int prom_getparent(int node) | 55 | inline phandle prom_getparent(phandle node) |
56 | { | 56 | { |
57 | int cnode; | 57 | phandle cnode; |
58 | 58 | ||
59 | if (node == -1) | 59 | if (node == -1) |
60 | return 0; | 60 | return 0; |
@@ -67,14 +67,14 @@ inline int prom_getparent(int node) | |||
67 | /* Return the next sibling of node 'node' or zero if no more siblings | 67 | /* Return the next sibling of node 'node' or zero if no more siblings |
68 | * at this level of depth in the tree. | 68 | * at this level of depth in the tree. |
69 | */ | 69 | */ |
70 | inline int __prom_getsibling(int node) | 70 | inline phandle __prom_getsibling(phandle node) |
71 | { | 71 | { |
72 | return prom_node_to_node(prom_peer_name, node); | 72 | return prom_node_to_node(prom_peer_name, node); |
73 | } | 73 | } |
74 | 74 | ||
75 | inline int prom_getsibling(int node) | 75 | inline phandle prom_getsibling(phandle node) |
76 | { | 76 | { |
77 | int sibnode; | 77 | phandle sibnode; |
78 | 78 | ||
79 | if (node == -1) | 79 | if (node == -1) |
80 | return 0; | 80 | return 0; |
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(prom_getsibling); | |||
89 | /* Return the length in bytes of property 'prop' at node 'node'. | 89 | /* Return the length in bytes of property 'prop' at node 'node'. |
90 | * Return -1 on error. | 90 | * Return -1 on error. |
91 | */ | 91 | */ |
92 | inline int prom_getproplen(int node, const char *prop) | 92 | inline int prom_getproplen(phandle node, const char *prop) |
93 | { | 93 | { |
94 | unsigned long args[6]; | 94 | unsigned long args[6]; |
95 | 95 | ||
@@ -113,7 +113,7 @@ EXPORT_SYMBOL(prom_getproplen); | |||
113 | * 'buffer' which has a size of 'bufsize'. If the acquisition | 113 | * 'buffer' which has a size of 'bufsize'. If the acquisition |
114 | * was successful the length will be returned, else -1 is returned. | 114 | * was successful the length will be returned, else -1 is returned. |
115 | */ | 115 | */ |
116 | inline int prom_getproperty(int node, const char *prop, | 116 | inline int prom_getproperty(phandle node, const char *prop, |
117 | char *buffer, int bufsize) | 117 | char *buffer, int bufsize) |
118 | { | 118 | { |
119 | unsigned long args[8]; | 119 | unsigned long args[8]; |
@@ -141,7 +141,7 @@ EXPORT_SYMBOL(prom_getproperty); | |||
141 | /* Acquire an integer property and return its value. Returns -1 | 141 | /* Acquire an integer property and return its value. Returns -1 |
142 | * on failure. | 142 | * on failure. |
143 | */ | 143 | */ |
144 | inline int prom_getint(int node, const char *prop) | 144 | inline int prom_getint(phandle node, const char *prop) |
145 | { | 145 | { |
146 | int intprop; | 146 | int intprop; |
147 | 147 | ||
@@ -156,7 +156,7 @@ EXPORT_SYMBOL(prom_getint); | |||
156 | * integer. | 156 | * integer. |
157 | */ | 157 | */ |
158 | 158 | ||
159 | int prom_getintdefault(int node, const char *property, int deflt) | 159 | int prom_getintdefault(phandle node, const char *property, int deflt) |
160 | { | 160 | { |
161 | int retval; | 161 | int retval; |
162 | 162 | ||
@@ -169,7 +169,7 @@ int prom_getintdefault(int node, const char *property, int deflt) | |||
169 | EXPORT_SYMBOL(prom_getintdefault); | 169 | EXPORT_SYMBOL(prom_getintdefault); |
170 | 170 | ||
171 | /* Acquire a boolean property, 1=TRUE 0=FALSE. */ | 171 | /* Acquire a boolean property, 1=TRUE 0=FALSE. */ |
172 | int prom_getbool(int node, const char *prop) | 172 | int prom_getbool(phandle node, const char *prop) |
173 | { | 173 | { |
174 | int retval; | 174 | int retval; |
175 | 175 | ||
@@ -184,7 +184,8 @@ EXPORT_SYMBOL(prom_getbool); | |||
184 | * string on error. The char pointer is the user supplied string | 184 | * string on error. The char pointer is the user supplied string |
185 | * buffer. | 185 | * buffer. |
186 | */ | 186 | */ |
187 | void prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size) | 187 | void prom_getstring(phandle node, const char *prop, char *user_buf, |
188 | int ubuf_size) | ||
188 | { | 189 | { |
189 | int len; | 190 | int len; |
190 | 191 | ||
@@ -198,7 +199,7 @@ EXPORT_SYMBOL(prom_getstring); | |||
198 | /* Does the device at node 'node' have name 'name'? | 199 | /* Does the device at node 'node' have name 'name'? |
199 | * YES = 1 NO = 0 | 200 | * YES = 1 NO = 0 |
200 | */ | 201 | */ |
201 | int prom_nodematch(int node, const char *name) | 202 | int prom_nodematch(phandle node, const char *name) |
202 | { | 203 | { |
203 | char namebuf[128]; | 204 | char namebuf[128]; |
204 | prom_getproperty(node, "name", namebuf, sizeof(namebuf)); | 205 | prom_getproperty(node, "name", namebuf, sizeof(namebuf)); |
@@ -210,10 +211,10 @@ int prom_nodematch(int node, const char *name) | |||
210 | /* Search siblings at 'node_start' for a node with name | 211 | /* Search siblings at 'node_start' for a node with name |
211 | * 'nodename'. Return node if successful, zero if not. | 212 | * 'nodename'. Return node if successful, zero if not. |
212 | */ | 213 | */ |
213 | int prom_searchsiblings(int node_start, const char *nodename) | 214 | phandle prom_searchsiblings(phandle node_start, const char *nodename) |
214 | { | 215 | { |
215 | 216 | phandle thisnode; | |
216 | int thisnode, error; | 217 | int error; |
217 | char promlib_buf[128]; | 218 | char promlib_buf[128]; |
218 | 219 | ||
219 | for(thisnode = node_start; thisnode; | 220 | for(thisnode = node_start; thisnode; |
@@ -234,7 +235,7 @@ static const char *prom_nextprop_name = "nextprop"; | |||
234 | /* Return the first property type for node 'node'. | 235 | /* Return the first property type for node 'node'. |
235 | * buffer should be at least 32B in length | 236 | * buffer should be at least 32B in length |
236 | */ | 237 | */ |
237 | inline char *prom_firstprop(int node, char *buffer) | 238 | inline char *prom_firstprop(phandle node, char *buffer) |
238 | { | 239 | { |
239 | unsigned long args[7]; | 240 | unsigned long args[7]; |
240 | 241 | ||
@@ -260,7 +261,7 @@ EXPORT_SYMBOL(prom_firstprop); | |||
260 | * at node 'node' . Returns NULL string if no more | 261 | * at node 'node' . Returns NULL string if no more |
261 | * property types for this node. | 262 | * property types for this node. |
262 | */ | 263 | */ |
263 | inline char *prom_nextprop(int node, const char *oprop, char *buffer) | 264 | inline char *prom_nextprop(phandle node, const char *oprop, char *buffer) |
264 | { | 265 | { |
265 | unsigned long args[7]; | 266 | unsigned long args[7]; |
266 | char buf[32]; | 267 | char buf[32]; |
@@ -288,8 +289,7 @@ inline char *prom_nextprop(int node, const char *oprop, char *buffer) | |||
288 | } | 289 | } |
289 | EXPORT_SYMBOL(prom_nextprop); | 290 | EXPORT_SYMBOL(prom_nextprop); |
290 | 291 | ||
291 | int | 292 | phandle prom_finddevice(const char *name) |
292 | prom_finddevice(const char *name) | ||
293 | { | 293 | { |
294 | unsigned long args[5]; | 294 | unsigned long args[5]; |
295 | 295 | ||
@@ -307,7 +307,7 @@ prom_finddevice(const char *name) | |||
307 | } | 307 | } |
308 | EXPORT_SYMBOL(prom_finddevice); | 308 | EXPORT_SYMBOL(prom_finddevice); |
309 | 309 | ||
310 | int prom_node_has_property(int node, const char *prop) | 310 | int prom_node_has_property(phandle node, const char *prop) |
311 | { | 311 | { |
312 | char buf [32]; | 312 | char buf [32]; |
313 | 313 | ||
@@ -325,7 +325,7 @@ EXPORT_SYMBOL(prom_node_has_property); | |||
325 | * of 'size' bytes. Return the number of bytes the prom accepted. | 325 | * of 'size' bytes. Return the number of bytes the prom accepted. |
326 | */ | 326 | */ |
327 | int | 327 | int |
328 | prom_setprop(int node, const char *pname, char *value, int size) | 328 | prom_setprop(phandle node, const char *pname, char *value, int size) |
329 | { | 329 | { |
330 | unsigned long args[8]; | 330 | unsigned long args[8]; |
331 | 331 | ||
@@ -355,10 +355,10 @@ prom_setprop(int node, const char *pname, char *value, int size) | |||
355 | } | 355 | } |
356 | EXPORT_SYMBOL(prom_setprop); | 356 | EXPORT_SYMBOL(prom_setprop); |
357 | 357 | ||
358 | inline int prom_inst2pkg(int inst) | 358 | inline phandle prom_inst2pkg(int inst) |
359 | { | 359 | { |
360 | unsigned long args[5]; | 360 | unsigned long args[5]; |
361 | int node; | 361 | phandle node; |
362 | 362 | ||
363 | args[0] = (unsigned long) "instance-to-package"; | 363 | args[0] = (unsigned long) "instance-to-package"; |
364 | args[1] = 1; | 364 | args[1] = 1; |
@@ -377,10 +377,10 @@ inline int prom_inst2pkg(int inst) | |||
377 | /* Return 'node' assigned to a particular prom 'path' | 377 | /* Return 'node' assigned to a particular prom 'path' |
378 | * FIXME: Should work for v0 as well | 378 | * FIXME: Should work for v0 as well |
379 | */ | 379 | */ |
380 | int | 380 | phandle prom_pathtoinode(const char *path) |
381 | prom_pathtoinode(const char *path) | ||
382 | { | 381 | { |
383 | int node, inst; | 382 | phandle node; |
383 | int inst; | ||
384 | 384 | ||
385 | inst = prom_devopen (path); | 385 | inst = prom_devopen (path); |
386 | if (inst == 0) | 386 | if (inst == 0) |