aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/prom/tree_64.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/prom/tree_64.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/prom/tree_64.c')
-rw-r--r--arch/sparc/prom/tree_64.c62
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
19static int prom_node_to_node(const char *type, int node) 19static 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 */
37inline int __prom_getchild(int node) 37inline 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
42inline int prom_getchild(int node) 42inline 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}
53EXPORT_SYMBOL(prom_getchild); 53EXPORT_SYMBOL(prom_getchild);
54 54
55inline int prom_getparent(int node) 55inline 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 */
70inline int __prom_getsibling(int node) 70inline 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
75inline int prom_getsibling(int node) 75inline 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 */
92inline int prom_getproplen(int node, const char *prop) 92inline 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 */
116inline int prom_getproperty(int node, const char *prop, 116inline 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 */
144inline int prom_getint(int node, const char *prop) 144inline 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
159int prom_getintdefault(int node, const char *property, int deflt) 159int 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)
169EXPORT_SYMBOL(prom_getintdefault); 169EXPORT_SYMBOL(prom_getintdefault);
170 170
171/* Acquire a boolean property, 1=TRUE 0=FALSE. */ 171/* Acquire a boolean property, 1=TRUE 0=FALSE. */
172int prom_getbool(int node, const char *prop) 172int 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 */
187void prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size) 187void 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 */
201int prom_nodematch(int node, const char *name) 202int 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 */
213int prom_searchsiblings(int node_start, const char *nodename) 214phandle 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 */
237inline char *prom_firstprop(int node, char *buffer) 238inline 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 */
263inline char *prom_nextprop(int node, const char *oprop, char *buffer) 264inline 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}
289EXPORT_SYMBOL(prom_nextprop); 290EXPORT_SYMBOL(prom_nextprop);
290 291
291int 292phandle prom_finddevice(const char *name)
292prom_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}
308EXPORT_SYMBOL(prom_finddevice); 308EXPORT_SYMBOL(prom_finddevice);
309 309
310int prom_node_has_property(int node, const char *prop) 310int 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 */
327int 327int
328prom_setprop(int node, const char *pname, char *value, int size) 328prom_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}
356EXPORT_SYMBOL(prom_setprop); 356EXPORT_SYMBOL(prom_setprop);
357 357
358inline int prom_inst2pkg(int inst) 358inline 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 */
380int 380phandle prom_pathtoinode(const char *path)
381prom_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)