Commit 8d1255627d4ce9cb4b9d0a1c44b6c18d92e84a99
Committed by
Grant Likely
1 parent
4e13efc991
Exists in
master
and in
4 other branches
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>
Showing 23 changed files with 157 additions and 144 deletions Side-by-side Diff
- arch/sparc/include/asm/floppy_32.h
- arch/sparc/include/asm/openprom.h
- arch/sparc/include/asm/oplib_32.h
- arch/sparc/include/asm/oplib_64.h
- arch/sparc/kernel/auxio_32.c
- arch/sparc/kernel/btext.c
- arch/sparc/kernel/devices.c
- arch/sparc/kernel/pcic.c
- arch/sparc/kernel/setup_64.c
- arch/sparc/kernel/starfire.c
- arch/sparc/kernel/tadpole.c
- arch/sparc/mm/init_64.c
- arch/sparc/mm/srmmu.c
- arch/sparc/mm/sun4c.c
- arch/sparc/prom/init_32.c
- arch/sparc/prom/init_64.c
- arch/sparc/prom/memory.c
- arch/sparc/prom/misc_64.c
- arch/sparc/prom/ranges.c
- arch/sparc/prom/tree_32.c
- arch/sparc/prom/tree_64.c
- drivers/sbus/char/jsflash.c
- drivers/video/aty/atyfb_base.c
arch/sparc/include/asm/floppy_32.h
arch/sparc/include/asm/openprom.h
... | ... | @@ -11,6 +11,8 @@ |
11 | 11 | #define LINUX_OPPROM_MAGIC 0x10010407 |
12 | 12 | |
13 | 13 | #ifndef __ASSEMBLY__ |
14 | +#include <linux/of.h> | |
15 | + | |
14 | 16 | /* V0 prom device operations. */ |
15 | 17 | struct linux_dev_v0_funcs { |
16 | 18 | int (*v0_devopen)(char *device_str); |
... | ... | @@ -26,7 +28,7 @@ |
26 | 28 | |
27 | 29 | /* V2 and later prom device operations. */ |
28 | 30 | struct linux_dev_v2_funcs { |
29 | - int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */ | |
31 | + phandle (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */ | |
30 | 32 | char * (*v2_dumb_mem_alloc)(char *va, unsigned sz); |
31 | 33 | void (*v2_dumb_mem_free)(char *va, unsigned sz); |
32 | 34 | |
... | ... | @@ -168,12 +170,12 @@ |
168 | 170 | |
169 | 171 | /* Routines for traversing the prom device tree. */ |
170 | 172 | struct linux_nodeops { |
171 | - int (*no_nextnode)(int node); | |
172 | - int (*no_child)(int node); | |
173 | - int (*no_proplen)(int node, const char *name); | |
174 | - int (*no_getprop)(int node, const char *name, char *val); | |
175 | - int (*no_setprop)(int node, const char *name, char *val, int len); | |
176 | - char * (*no_nextprop)(int node, char *name); | |
173 | + phandle (*no_nextnode)(phandle node); | |
174 | + phandle (*no_child)(phandle node); | |
175 | + int (*no_proplen)(phandle node, const char *name); | |
176 | + int (*no_getprop)(phandle node, const char *name, char *val); | |
177 | + int (*no_setprop)(phandle node, const char *name, char *val, int len); | |
178 | + char * (*no_nextprop)(phandle node, char *name); | |
177 | 179 | }; |
178 | 180 | |
179 | 181 | /* More fun PROM structures for device probing. */ |
arch/sparc/include/asm/oplib_32.h
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | /* Root node of the prom device tree, this stays constant after |
31 | 31 | * initialization is complete. |
32 | 32 | */ |
33 | -extern int prom_root_node; | |
33 | +extern phandle prom_root_node; | |
34 | 34 | |
35 | 35 | /* Pointer to prom structure containing the device tree traversal |
36 | 36 | * and usage utility functions. Only prom-lib should use these, |
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | 51 | |
... | ... | @@ -178,68 +178,68 @@ |
178 | 178 | /* PROM device tree traversal functions... */ |
179 | 179 | |
180 | 180 | /* Get the child node of the given node, or zero if no child exists. */ |
181 | -extern int prom_getchild(int parent_node); | |
181 | +extern phandle prom_getchild(phandle parent_node); | |
182 | 182 | |
183 | 183 | /* Get the next sibling node of the given node, or zero if no further |
184 | 184 | * siblings exist. |
185 | 185 | */ |
186 | -extern int prom_getsibling(int node); | |
186 | +extern phandle prom_getsibling(phandle node); | |
187 | 187 | |
188 | 188 | /* Get the length, at the passed node, of the given property type. |
189 | 189 | * Returns -1 on error (ie. no such property at this node). |
190 | 190 | */ |
191 | -extern int prom_getproplen(int thisnode, const char *property); | |
191 | +extern int prom_getproplen(phandle thisnode, const char *property); | |
192 | 192 | |
193 | 193 | /* Fetch the requested property using the given buffer. Returns |
194 | 194 | * the number of bytes the prom put into your buffer or -1 on error. |
195 | 195 | */ |
196 | -extern int __must_check prom_getproperty(int thisnode, const char *property, | |
196 | +extern int __must_check prom_getproperty(phandle thisnode, const char *property, | |
197 | 197 | char *prop_buffer, int propbuf_size); |
198 | 198 | |
199 | 199 | /* Acquire an integer property. */ |
200 | -extern int prom_getint(int node, char *property); | |
200 | +extern int prom_getint(phandle node, char *property); | |
201 | 201 | |
202 | 202 | /* Acquire an integer property, with a default value. */ |
203 | -extern int prom_getintdefault(int node, char *property, int defval); | |
203 | +extern int prom_getintdefault(phandle node, char *property, int defval); | |
204 | 204 | |
205 | 205 | /* Acquire a boolean property, 0=FALSE 1=TRUE. */ |
206 | -extern int prom_getbool(int node, char *prop); | |
206 | +extern int prom_getbool(phandle node, char *prop); | |
207 | 207 | |
208 | 208 | /* Acquire a string property, null string on error. */ |
209 | -extern void prom_getstring(int node, char *prop, char *buf, int bufsize); | |
209 | +extern void prom_getstring(phandle node, char *prop, char *buf, int bufsize); | |
210 | 210 | |
211 | 211 | /* Does the passed node have the given "name"? YES=1 NO=0 */ |
212 | -extern int prom_nodematch(int thisnode, char *name); | |
212 | +extern int prom_nodematch(phandle thisnode, char *name); | |
213 | 213 | |
214 | 214 | /* Search all siblings starting at the passed node for "name" matching |
215 | 215 | * the given string. Returns the node on success, zero on failure. |
216 | 216 | */ |
217 | -extern int prom_searchsiblings(int node_start, char *name); | |
217 | +extern phandle prom_searchsiblings(phandle node_start, char *name); | |
218 | 218 | |
219 | 219 | /* Return the first property type, as a string, for the given node. |
220 | 220 | * Returns a null string on error. |
221 | 221 | */ |
222 | -extern char *prom_firstprop(int node, char *buffer); | |
222 | +extern char *prom_firstprop(phandle node, char *buffer); | |
223 | 223 | |
224 | 224 | /* Returns the next property after the passed property for the given |
225 | 225 | * node. Returns null string on failure. |
226 | 226 | */ |
227 | -extern char *prom_nextprop(int node, char *prev_property, char *buffer); | |
227 | +extern char *prom_nextprop(phandle node, char *prev_property, char *buffer); | |
228 | 228 | |
229 | 229 | /* Returns phandle of the path specified */ |
230 | -extern int prom_finddevice(char *name); | |
230 | +extern phandle prom_finddevice(char *name); | |
231 | 231 | |
232 | 232 | /* Returns 1 if the specified node has given property. */ |
233 | -extern int prom_node_has_property(int node, char *property); | |
233 | +extern int prom_node_has_property(phandle node, char *property); | |
234 | 234 | |
235 | 235 | /* Set the indicated property at the given node with the passed value. |
236 | 236 | * Returns the number of bytes of your value that the prom took. |
237 | 237 | */ |
238 | -extern int prom_setprop(int node, const char *prop_name, char *prop_value, | |
238 | +extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, | |
239 | 239 | int value_size); |
240 | 240 | |
241 | -extern int prom_pathtoinode(char *path); | |
242 | -extern int prom_inst2pkg(int); | |
241 | +extern phandle prom_pathtoinode(char *path); | |
242 | +extern phandle prom_inst2pkg(int); | |
243 | 243 | |
244 | 244 | /* Dorking with Bus ranges... */ |
245 | 245 | |
246 | 246 | |
... | ... | @@ -247,13 +247,13 @@ |
247 | 247 | extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); |
248 | 248 | |
249 | 249 | /* Apply ranges of any prom node (and optionally parent node as well) to registers. */ |
250 | -extern void prom_apply_generic_ranges(int node, int parent, | |
250 | +extern void prom_apply_generic_ranges(phandle node, phandle parent, | |
251 | 251 | struct linux_prom_registers *sbusregs, int nregs); |
252 | 252 | |
253 | 253 | /* CPU probing helpers. */ |
254 | -int cpu_find_by_instance(int instance, int *prom_node, int *mid); | |
255 | -int cpu_find_by_mid(int mid, int *prom_node); | |
256 | -int cpu_get_hwmid(int prom_node); | |
254 | +int cpu_find_by_instance(int instance, phandle *prom_node, int *mid); | |
255 | +int cpu_find_by_mid(int mid, phandle *prom_node); | |
256 | +int cpu_get_hwmid(phandle prom_node); | |
257 | 257 | |
258 | 258 | extern spinlock_t prom_lock; |
259 | 259 |
arch/sparc/include/asm/oplib_64.h
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | /* Root node of the prom device tree, this stays constant after |
17 | 17 | * initialization is complete. |
18 | 18 | */ |
19 | -extern int prom_root_node; | |
19 | +extern phandle prom_root_node; | |
20 | 20 | |
21 | 21 | /* PROM stdin and stdout */ |
22 | 22 | extern int prom_stdin, prom_stdout; |
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | /* /chosen node of the prom device tree, this stays constant after |
25 | 25 | * initialization is complete. |
26 | 26 | */ |
27 | -extern int prom_chosen_node; | |
27 | +extern phandle prom_chosen_node; | |
28 | 28 | |
29 | 29 | /* Helper values and strings in arch/sparc64/kernel/head.S */ |
30 | 30 | extern const char prom_peer_name[]; |
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | 45 | |
... | ... | @@ -218,68 +218,69 @@ |
218 | 218 | /* PROM device tree traversal functions... */ |
219 | 219 | |
220 | 220 | /* Get the child node of the given node, or zero if no child exists. */ |
221 | -extern int prom_getchild(int parent_node); | |
221 | +extern phandle prom_getchild(phandle parent_node); | |
222 | 222 | |
223 | 223 | /* Get the next sibling node of the given node, or zero if no further |
224 | 224 | * siblings exist. |
225 | 225 | */ |
226 | -extern int prom_getsibling(int node); | |
226 | +extern phandle prom_getsibling(phandle node); | |
227 | 227 | |
228 | 228 | /* Get the length, at the passed node, of the given property type. |
229 | 229 | * Returns -1 on error (ie. no such property at this node). |
230 | 230 | */ |
231 | -extern int prom_getproplen(int thisnode, const char *property); | |
231 | +extern int prom_getproplen(phandle thisnode, const char *property); | |
232 | 232 | |
233 | 233 | /* Fetch the requested property using the given buffer. Returns |
234 | 234 | * the number of bytes the prom put into your buffer or -1 on error. |
235 | 235 | */ |
236 | -extern int prom_getproperty(int thisnode, const char *property, | |
236 | +extern int prom_getproperty(phandle thisnode, const char *property, | |
237 | 237 | char *prop_buffer, int propbuf_size); |
238 | 238 | |
239 | 239 | /* Acquire an integer property. */ |
240 | -extern int prom_getint(int node, const char *property); | |
240 | +extern int prom_getint(phandle node, const char *property); | |
241 | 241 | |
242 | 242 | /* Acquire an integer property, with a default value. */ |
243 | -extern int prom_getintdefault(int node, const char *property, int defval); | |
243 | +extern int prom_getintdefault(phandle node, const char *property, int defval); | |
244 | 244 | |
245 | 245 | /* Acquire a boolean property, 0=FALSE 1=TRUE. */ |
246 | -extern int prom_getbool(int node, const char *prop); | |
246 | +extern int prom_getbool(phandle node, const char *prop); | |
247 | 247 | |
248 | 248 | /* Acquire a string property, null string on error. */ |
249 | -extern void prom_getstring(int node, const char *prop, char *buf, int bufsize); | |
249 | +extern void prom_getstring(phandle node, const char *prop, char *buf, | |
250 | + int bufsize); | |
250 | 251 | |
251 | 252 | /* Does the passed node have the given "name"? YES=1 NO=0 */ |
252 | -extern int prom_nodematch(int thisnode, const char *name); | |
253 | +extern int prom_nodematch(phandle thisnode, const char *name); | |
253 | 254 | |
254 | 255 | /* Search all siblings starting at the passed node for "name" matching |
255 | 256 | * the given string. Returns the node on success, zero on failure. |
256 | 257 | */ |
257 | -extern int prom_searchsiblings(int node_start, const char *name); | |
258 | +extern phandle prom_searchsiblings(phandle node_start, const char *name); | |
258 | 259 | |
259 | 260 | /* Return the first property type, as a string, for the given node. |
260 | 261 | * Returns a null string on error. Buffer should be at least 32B long. |
261 | 262 | */ |
262 | -extern char *prom_firstprop(int node, char *buffer); | |
263 | +extern char *prom_firstprop(phandle node, char *buffer); | |
263 | 264 | |
264 | 265 | /* Returns the next property after the passed property for the given |
265 | 266 | * node. Returns null string on failure. Buffer should be at least 32B long. |
266 | 267 | */ |
267 | -extern char *prom_nextprop(int node, const char *prev_property, char *buffer); | |
268 | +extern char *prom_nextprop(phandle node, const char *prev_property, char *buf); | |
268 | 269 | |
269 | 270 | /* Returns 1 if the specified node has given property. */ |
270 | -extern int prom_node_has_property(int node, const char *property); | |
271 | +extern int prom_node_has_property(phandle node, const char *property); | |
271 | 272 | |
272 | 273 | /* Returns phandle of the path specified */ |
273 | -extern int prom_finddevice(const char *name); | |
274 | +extern phandle prom_finddevice(const char *name); | |
274 | 275 | |
275 | 276 | /* Set the indicated property at the given node with the passed value. |
276 | 277 | * Returns the number of bytes of your value that the prom took. |
277 | 278 | */ |
278 | -extern int prom_setprop(int node, const char *prop_name, char *prop_value, | |
279 | +extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, | |
279 | 280 | int value_size); |
280 | 281 | |
281 | -extern int prom_pathtoinode(const char *path); | |
282 | -extern int prom_inst2pkg(int); | |
282 | +extern phandle prom_pathtoinode(const char *path); | |
283 | +extern phandle prom_inst2pkg(int); | |
283 | 284 | extern int prom_service_exists(const char *service_name); |
284 | 285 | extern void prom_sun4v_guest_soft_state(void); |
285 | 286 |
arch/sparc/kernel/auxio_32.c
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | |
24 | 24 | void __init auxio_probe(void) |
25 | 25 | { |
26 | - int node, auxio_nd; | |
26 | + phandle node, auxio_nd; | |
27 | 27 | struct linux_prom_registers auxregs[1]; |
28 | 28 | struct resource r; |
29 | 29 | |
... | ... | @@ -113,7 +113,7 @@ |
113 | 113 | void __init auxio_power_probe(void) |
114 | 114 | { |
115 | 115 | struct linux_prom_registers regs; |
116 | - int node; | |
116 | + phandle node; | |
117 | 117 | struct resource r; |
118 | 118 | |
119 | 119 | /* Attempt to find the sun4m power control node. */ |
arch/sparc/kernel/btext.c
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | |
41 | 41 | static unsigned char vga_font[cmapsz]; |
42 | 42 | |
43 | -static int __init btext_initialize(unsigned int node) | |
43 | +static int __init btext_initialize(phandle node) | |
44 | 44 | { |
45 | 45 | unsigned int width, height, depth, pitch; |
46 | 46 | unsigned long address = 0; |
... | ... | @@ -309,7 +309,7 @@ |
309 | 309 | |
310 | 310 | int __init btext_find_display(void) |
311 | 311 | { |
312 | - unsigned int node; | |
312 | + phandle node; | |
313 | 313 | char type[32]; |
314 | 314 | int ret; |
315 | 315 |
arch/sparc/kernel/devices.c
... | ... | @@ -31,9 +31,9 @@ |
31 | 31 | return "mid"; |
32 | 32 | } |
33 | 33 | |
34 | -static int check_cpu_node(int nd, int *cur_inst, | |
35 | - int (*compare)(int, int, void *), void *compare_arg, | |
36 | - int *prom_node, int *mid) | |
34 | +static int check_cpu_node(phandle nd, int *cur_inst, | |
35 | + int (*compare)(phandle, int, void *), void *compare_arg, | |
36 | + phandle *prom_node, int *mid) | |
37 | 37 | { |
38 | 38 | if (!compare(nd, *cur_inst, compare_arg)) { |
39 | 39 | if (prom_node) |
... | ... | @@ -51,8 +51,8 @@ |
51 | 51 | return -ENODEV; |
52 | 52 | } |
53 | 53 | |
54 | -static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg, | |
55 | - int *prom_node, int *mid) | |
54 | +static int __cpu_find_by(int (*compare)(phandle, int, void *), | |
55 | + void *compare_arg, phandle *prom_node, int *mid) | |
56 | 56 | { |
57 | 57 | struct device_node *dp; |
58 | 58 | int cur_inst; |
... | ... | @@ -71,7 +71,7 @@ |
71 | 71 | return -ENODEV; |
72 | 72 | } |
73 | 73 | |
74 | -static int cpu_instance_compare(int nd, int instance, void *_arg) | |
74 | +static int cpu_instance_compare(phandle nd, int instance, void *_arg) | |
75 | 75 | { |
76 | 76 | int desired_instance = (int) _arg; |
77 | 77 | |
78 | 78 | |
... | ... | @@ -80,13 +80,13 @@ |
80 | 80 | return -ENODEV; |
81 | 81 | } |
82 | 82 | |
83 | -int cpu_find_by_instance(int instance, int *prom_node, int *mid) | |
83 | +int cpu_find_by_instance(int instance, phandle *prom_node, int *mid) | |
84 | 84 | { |
85 | 85 | return __cpu_find_by(cpu_instance_compare, (void *)instance, |
86 | 86 | prom_node, mid); |
87 | 87 | } |
88 | 88 | |
89 | -static int cpu_mid_compare(int nd, int instance, void *_arg) | |
89 | +static int cpu_mid_compare(phandle nd, int instance, void *_arg) | |
90 | 90 | { |
91 | 91 | int desired_mid = (int) _arg; |
92 | 92 | int this_mid; |
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | return -ENODEV; |
99 | 99 | } |
100 | 100 | |
101 | -int cpu_find_by_mid(int mid, int *prom_node) | |
101 | +int cpu_find_by_mid(int mid, phandle *prom_node) | |
102 | 102 | { |
103 | 103 | return __cpu_find_by(cpu_mid_compare, (void *)mid, |
104 | 104 | prom_node, NULL); |
... | ... | @@ -108,7 +108,7 @@ |
108 | 108 | * address (0-3). This gives us the true hardware mid, which might have |
109 | 109 | * some other bits set. On 4d hardware and software mids are the same. |
110 | 110 | */ |
111 | -int cpu_get_hwmid(int prom_node) | |
111 | +int cpu_get_hwmid(phandle prom_node) | |
112 | 112 | { |
113 | 113 | return prom_getintdefault(prom_node, cpu_mid_prop(), -ENODEV); |
114 | 114 | } |
... | ... | @@ -119,7 +119,8 @@ |
119 | 119 | |
120 | 120 | #ifndef CONFIG_SMP |
121 | 121 | { |
122 | - int err, cpu_node; | |
122 | + phandle cpu_node; | |
123 | + int err; | |
123 | 124 | err = cpu_find_by_instance(0, &cpu_node, NULL); |
124 | 125 | if (err) { |
125 | 126 | /* Probably a sun4e, Sun is trying to trick us ;-) */ |
arch/sparc/kernel/pcic.c
... | ... | @@ -284,7 +284,7 @@ |
284 | 284 | struct linux_prom_registers regs[PROMREG_MAX]; |
285 | 285 | struct linux_pbm_info* pbm; |
286 | 286 | char namebuf[64]; |
287 | - int node; | |
287 | + phandle node; | |
288 | 288 | int err; |
289 | 289 | |
290 | 290 | if (pcic0_up) { |
... | ... | @@ -440,7 +440,7 @@ |
440 | 440 | { |
441 | 441 | struct linux_prom_pci_registers regs[PROMREG_MAX]; |
442 | 442 | int err; |
443 | - int node = prom_getchild(pbm->prom_node); | |
443 | + phandle node = prom_getchild(pbm->prom_node); | |
444 | 444 | |
445 | 445 | while(node) { |
446 | 446 | err = prom_getproperty(node, "reg", |
arch/sparc/kernel/setup_64.c
arch/sparc/kernel/starfire.c
arch/sparc/kernel/tadpole.c
arch/sparc/mm/init_64.c
arch/sparc/mm/srmmu.c
... | ... | @@ -1262,7 +1262,8 @@ |
1262 | 1262 | |
1263 | 1263 | void __init srmmu_paging_init(void) |
1264 | 1264 | { |
1265 | - int i, cpunode; | |
1265 | + int i; | |
1266 | + phandle cpunode; | |
1266 | 1267 | char node_str[128]; |
1267 | 1268 | pgd_t *pgd; |
1268 | 1269 | pmd_t *pmd; |
... | ... | @@ -1398,7 +1399,8 @@ |
1398 | 1399 | |
1399 | 1400 | static void __init init_vac_layout(void) |
1400 | 1401 | { |
1401 | - int nd, cache_lines; | |
1402 | + phandle nd; | |
1403 | + int cache_lines; | |
1402 | 1404 | char node_str[128]; |
1403 | 1405 | #ifdef CONFIG_SMP |
1404 | 1406 | int cpu = 0; |
... | ... | @@ -2082,7 +2084,7 @@ |
2082 | 2084 | |
2083 | 2085 | /* Next check for Fujitsu Swift. */ |
2084 | 2086 | if(psr_typ == 0 && psr_vers == 4) { |
2085 | - int cpunode; | |
2087 | + phandle cpunode; | |
2086 | 2088 | char node_str[128]; |
2087 | 2089 | |
2088 | 2090 | /* Look if it is not a TurboSparc emulating Swift... */ |
arch/sparc/mm/sun4c.c
arch/sparc/prom/init_32.c
arch/sparc/prom/init_64.c
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | |
20 | 20 | /* The root node of the prom device tree. */ |
21 | 21 | int prom_stdin, prom_stdout; |
22 | -int prom_chosen_node; | |
22 | +phandle prom_chosen_node; | |
23 | 23 | |
24 | 24 | /* You must call prom_init() before you attempt to use any of the |
25 | 25 | * routines in the prom library. It returns 0 on success, 1 on |
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | |
31 | 31 | void __init prom_init(void *cif_handler, void *cif_stack) |
32 | 32 | { |
33 | - int node; | |
33 | + phandle node; | |
34 | 34 | |
35 | 35 | prom_cif_init(cif_handler, cif_stack); |
36 | 36 |
arch/sparc/prom/memory.c
... | ... | @@ -31,7 +31,8 @@ |
31 | 31 | static int __init prom_meminit_v2(void) |
32 | 32 | { |
33 | 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 | 37 | node = prom_searchsiblings(prom_getchild(prom_root_node), "memory"); |
37 | 38 | size = prom_getproperty(node, "available", (char *) reg, sizeof(reg)); |
arch/sparc/prom/misc_64.c
... | ... | @@ -183,7 +183,8 @@ |
183 | 183 | |
184 | 184 | int prom_get_mmu_ihandle(void) |
185 | 185 | { |
186 | - int node, ret; | |
186 | + phandle node; | |
187 | + int ret; | |
187 | 188 | |
188 | 189 | if (prom_mmu_ihandle_cache != 0) |
189 | 190 | return prom_mmu_ihandle_cache; |
... | ... | @@ -201,7 +202,8 @@ |
201 | 202 | static int prom_get_memory_ihandle(void) |
202 | 203 | { |
203 | 204 | static int memory_ihandle_cache; |
204 | - int node, ret; | |
205 | + phandle node; | |
206 | + int ret; | |
205 | 207 | |
206 | 208 | if (memory_ihandle_cache != 0) |
207 | 209 | return memory_ihandle_cache; |
arch/sparc/prom/ranges.c
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | |
69 | 69 | void __init prom_ranges_init(void) |
70 | 70 | { |
71 | - int node, obio_node; | |
71 | + phandle node, obio_node; | |
72 | 72 | int success; |
73 | 73 | |
74 | 74 | num_obio_ranges = 0; |
... | ... | @@ -89,8 +89,8 @@ |
89 | 89 | prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); |
90 | 90 | } |
91 | 91 | |
92 | -void | |
93 | -prom_apply_generic_ranges (int node, int parent, struct linux_prom_registers *regs, int nregs) | |
92 | +void prom_apply_generic_ranges(phandle node, phandle parent, | |
93 | + struct linux_prom_registers *regs, int nregs) | |
94 | 94 | { |
95 | 95 | int success; |
96 | 96 | int num_ranges; |
arch/sparc/prom/tree_32.c
... | ... | @@ -20,10 +20,10 @@ |
20 | 20 | static char promlib_buf[128]; |
21 | 21 | |
22 | 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 | 25 | unsigned long flags; |
26 | - int cnode; | |
26 | + phandle cnode; | |
27 | 27 | |
28 | 28 | spin_lock_irqsave(&prom_lock, flags); |
29 | 29 | cnode = prom_nodeops->no_child(node); |
30 | 30 | |
... | ... | @@ -36,9 +36,9 @@ |
36 | 36 | /* Return the child of node 'node' or zero if no this node has no |
37 | 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 | 43 | if (node == -1) |
44 | 44 | return 0; |
45 | 45 | |
... | ... | @@ -52,10 +52,10 @@ |
52 | 52 | EXPORT_SYMBOL(prom_getchild); |
53 | 53 | |
54 | 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 | 57 | unsigned long flags; |
58 | - int cnode; | |
58 | + phandle cnode; | |
59 | 59 | |
60 | 60 | spin_lock_irqsave(&prom_lock, flags); |
61 | 61 | cnode = prom_nodeops->no_nextnode(node); |
62 | 62 | |
... | ... | @@ -68,9 +68,9 @@ |
68 | 68 | /* Return the next sibling of node 'node' or zero if no more siblings |
69 | 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 | 75 | if (node == -1) |
76 | 76 | return 0; |
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | /* Return the length in bytes of property 'prop' at node 'node'. |
87 | 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 | 91 | int ret; |
92 | 92 | unsigned long flags; |
... | ... | @@ -106,7 +106,7 @@ |
106 | 106 | * 'buffer' which has a size of 'bufsize'. If the acquisition |
107 | 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 | 111 | int plen, ret; |
112 | 112 | unsigned long flags; |
... | ... | @@ -126,7 +126,7 @@ |
126 | 126 | /* Acquire an integer property and return its value. Returns -1 |
127 | 127 | * on failure. |
128 | 128 | */ |
129 | -int prom_getint(int node, char *prop) | |
129 | +int prom_getint(phandle node, char *prop) | |
130 | 130 | { |
131 | 131 | static int intprop; |
132 | 132 | |
... | ... | @@ -140,7 +140,7 @@ |
140 | 140 | /* Acquire an integer property, upon error return the passed default |
141 | 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 | 145 | int retval; |
146 | 146 | |
... | ... | @@ -152,7 +152,7 @@ |
152 | 152 | EXPORT_SYMBOL(prom_getintdefault); |
153 | 153 | |
154 | 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 | 157 | int retval; |
158 | 158 | |
... | ... | @@ -166,7 +166,7 @@ |
166 | 166 | * string on error. The char pointer is the user supplied string |
167 | 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 | 171 | int len; |
172 | 172 | |
... | ... | @@ -180,7 +180,7 @@ |
180 | 180 | /* Does the device at node 'node' have name 'name'? |
181 | 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 | 185 | int error; |
186 | 186 | |
187 | 187 | |
... | ... | @@ -194,10 +194,11 @@ |
194 | 194 | /* Search siblings at 'node_start' for a node with name |
195 | 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 | 203 | for(thisnode = node_start; thisnode; |
203 | 204 | thisnode=prom_getsibling(thisnode)) { |
... | ... | @@ -213,7 +214,7 @@ |
213 | 214 | EXPORT_SYMBOL(prom_searchsiblings); |
214 | 215 | |
215 | 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 | 219 | unsigned long flags; |
219 | 220 | char *prop; |
... | ... | @@ -228,7 +229,7 @@ |
228 | 229 | |
229 | 230 | /* Return the first property name for node 'node'. */ |
230 | 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 | 234 | if (node == 0 || node == -1) |
234 | 235 | return ""; |
... | ... | @@ -241,7 +242,7 @@ |
241 | 242 | * at node 'node' . Returns empty string if no more |
242 | 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 | 247 | if (node == 0 || node == -1) |
247 | 248 | return ""; |
248 | 249 | |
... | ... | @@ -250,11 +251,11 @@ |
250 | 251 | } |
251 | 252 | EXPORT_SYMBOL(prom_nextprop); |
252 | 253 | |
253 | -int prom_finddevice(char *name) | |
254 | +phandle prom_finddevice(char *name) | |
254 | 255 | { |
255 | 256 | char nbuf[128]; |
256 | 257 | char *s = name, *d; |
257 | - int node = prom_root_node, node2; | |
258 | + phandle node = prom_root_node, node2; | |
258 | 259 | unsigned int which_io, phys_addr; |
259 | 260 | struct linux_prom_registers reg[PROMREG_MAX]; |
260 | 261 | |
... | ... | @@ -298,7 +299,7 @@ |
298 | 299 | } |
299 | 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 | 304 | char *current_property = ""; |
304 | 305 | |
... | ... | @@ -314,7 +315,7 @@ |
314 | 315 | /* Set property 'pname' at node 'node' to value 'value' which has a length |
315 | 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 | 320 | unsigned long flags; |
320 | 321 | int ret; |
321 | 322 | |
... | ... | @@ -329,9 +330,9 @@ |
329 | 330 | } |
330 | 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 | 336 | unsigned long flags; |
336 | 337 | |
337 | 338 | spin_lock_irqsave(&prom_lock, flags); |
338 | 339 | |
... | ... | @@ -345,9 +346,10 @@ |
345 | 346 | /* Return 'node' assigned to a particular prom 'path' |
346 | 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 | 354 | inst = prom_devopen (path); |
353 | 355 | if (inst == -1) return 0; |
arch/sparc/prom/tree_64.c
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | #include <asm/oplib.h> |
17 | 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 | 21 | unsigned long args[5]; |
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | 25 | |
... | ... | @@ -28,20 +28,20 @@ |
28 | 28 | |
29 | 29 | p1275_cmd_direct(args); |
30 | 30 | |
31 | - return (int) args[4]; | |
31 | + return (phandle) args[4]; | |
32 | 32 | } |
33 | 33 | |
34 | 34 | /* Return the child of node 'node' or zero if no this node has no |
35 | 35 | * direct descendent. |
36 | 36 | */ |
37 | -inline int __prom_getchild(int node) | |
37 | +inline phandle __prom_getchild(phandle node) | |
38 | 38 | { |
39 | 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 | 46 | if (node == -1) |
47 | 47 | return 0; |
48 | 48 | |
... | ... | @@ -52,9 +52,9 @@ |
52 | 52 | } |
53 | 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 | 59 | if (node == -1) |
60 | 60 | return 0; |
61 | 61 | |
62 | 62 | |
... | ... | @@ -67,14 +67,14 @@ |
67 | 67 | /* Return the next sibling of node 'node' or zero if no more siblings |
68 | 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 | 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 | 79 | if (node == -1) |
80 | 80 | return 0; |
... | ... | @@ -89,7 +89,7 @@ |
89 | 89 | /* Return the length in bytes of property 'prop' at node 'node'. |
90 | 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 | 94 | unsigned long args[6]; |
95 | 95 | |
... | ... | @@ -113,7 +113,7 @@ |
113 | 113 | * 'buffer' which has a size of 'bufsize'. If the acquisition |
114 | 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 | 117 | char *buffer, int bufsize) |
118 | 118 | { |
119 | 119 | unsigned long args[8]; |
... | ... | @@ -141,7 +141,7 @@ |
141 | 141 | /* Acquire an integer property and return its value. Returns -1 |
142 | 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 | 146 | int intprop; |
147 | 147 | |
... | ... | @@ -156,7 +156,7 @@ |
156 | 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 | 161 | int retval; |
162 | 162 | |
... | ... | @@ -169,7 +169,7 @@ |
169 | 169 | EXPORT_SYMBOL(prom_getintdefault); |
170 | 170 | |
171 | 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 | 174 | int retval; |
175 | 175 | |
... | ... | @@ -184,7 +184,8 @@ |
184 | 184 | * string on error. The char pointer is the user supplied string |
185 | 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 | 190 | int len; |
190 | 191 | |
... | ... | @@ -198,7 +199,7 @@ |
198 | 199 | /* Does the device at node 'node' have name 'name'? |
199 | 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 | 204 | char namebuf[128]; |
204 | 205 | prom_getproperty(node, "name", namebuf, sizeof(namebuf)); |
205 | 206 | |
... | ... | @@ -210,10 +211,10 @@ |
210 | 211 | /* Search siblings at 'node_start' for a node with name |
211 | 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 | - int thisnode, error; | |
216 | + phandle thisnode; | |
217 | + int error; | |
217 | 218 | char promlib_buf[128]; |
218 | 219 | |
219 | 220 | for(thisnode = node_start; thisnode; |
... | ... | @@ -234,7 +235,7 @@ |
234 | 235 | /* Return the first property type for node 'node'. |
235 | 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 | 240 | unsigned long args[7]; |
240 | 241 | |
... | ... | @@ -260,7 +261,7 @@ |
260 | 261 | * at node 'node' . Returns NULL string if no more |
261 | 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 | 266 | unsigned long args[7]; |
266 | 267 | char buf[32]; |
... | ... | @@ -288,8 +289,7 @@ |
288 | 289 | } |
289 | 290 | EXPORT_SYMBOL(prom_nextprop); |
290 | 291 | |
291 | -int | |
292 | -prom_finddevice(const char *name) | |
292 | +phandle prom_finddevice(const char *name) | |
293 | 293 | { |
294 | 294 | unsigned long args[5]; |
295 | 295 | |
... | ... | @@ -307,7 +307,7 @@ |
307 | 307 | } |
308 | 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 | 312 | char buf [32]; |
313 | 313 | |
... | ... | @@ -325,7 +325,7 @@ |
325 | 325 | * of 'size' bytes. Return the number of bytes the prom accepted. |
326 | 326 | */ |
327 | 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 | 330 | unsigned long args[8]; |
331 | 331 | |
332 | 332 | |
... | ... | @@ -355,10 +355,10 @@ |
355 | 355 | } |
356 | 356 | EXPORT_SYMBOL(prom_setprop); |
357 | 357 | |
358 | -inline int prom_inst2pkg(int inst) | |
358 | +inline phandle prom_inst2pkg(int inst) | |
359 | 359 | { |
360 | 360 | unsigned long args[5]; |
361 | - int node; | |
361 | + phandle node; | |
362 | 362 | |
363 | 363 | args[0] = (unsigned long) "instance-to-package"; |
364 | 364 | args[1] = 1; |
365 | 365 | |
... | ... | @@ -377,10 +377,10 @@ |
377 | 377 | /* Return 'node' assigned to a particular prom 'path' |
378 | 378 | * FIXME: Should work for v0 as well |
379 | 379 | */ |
380 | -int | |
381 | -prom_pathtoinode(const char *path) | |
380 | +phandle prom_pathtoinode(const char *path) | |
382 | 381 | { |
383 | - int node, inst; | |
382 | + phandle node; | |
383 | + int inst; | |
384 | 384 | |
385 | 385 | inst = prom_devopen (path); |
386 | 386 | if (inst == 0) |
drivers/sbus/char/jsflash.c
drivers/video/aty/atyfb_base.c