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/tree_64.c | |
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/tree_64.c')
-rw-r--r-- | arch/sparc/prom/tree_64.c | 62 |
1 files changed, 31 insertions, 31 deletions
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) |