diff options
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/prom_common.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index fe84d56b7c5a..ed25834328f4 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c | |||
@@ -118,11 +118,45 @@ int of_find_in_proplist(const char *list, const char *match, int len) | |||
118 | } | 118 | } |
119 | EXPORT_SYMBOL(of_find_in_proplist); | 119 | EXPORT_SYMBOL(of_find_in_proplist); |
120 | 120 | ||
121 | /* | ||
122 | * SPARC32 and SPARC64's prom_nextprop() do things differently | ||
123 | * here, despite sharing the same interface. SPARC32 doesn't fill in 'buf', | ||
124 | * returning NULL on an error. SPARC64 fills in 'buf', but sets it to an | ||
125 | * empty string upon error. | ||
126 | */ | ||
127 | static int __init handle_nextprop_quirks(char *buf, const char *name) | ||
128 | { | ||
129 | if (!name || strlen(name) == 0) | ||
130 | return -1; | ||
131 | |||
132 | #ifdef CONFIG_SPARC32 | ||
133 | strcpy(buf, name); | ||
134 | #endif | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static int __init prom_common_nextprop(phandle node, char *prev, char *buf) | ||
139 | { | ||
140 | const char *name; | ||
141 | |||
142 | buf[0] = '\0'; | ||
143 | name = prom_nextprop(node, prev, buf); | ||
144 | return handle_nextprop_quirks(buf, name); | ||
145 | } | ||
146 | |||
121 | unsigned int prom_early_allocated __initdata; | 147 | unsigned int prom_early_allocated __initdata; |
122 | 148 | ||
149 | static struct of_pdt_ops prom_sparc_ops __initdata = { | ||
150 | .nextprop = prom_common_nextprop, | ||
151 | .getproplen = prom_getproplen, | ||
152 | .getproperty = prom_getproperty, | ||
153 | .getchild = prom_getchild, | ||
154 | .getsibling = prom_getsibling, | ||
155 | }; | ||
156 | |||
123 | void __init prom_build_devicetree(void) | 157 | void __init prom_build_devicetree(void) |
124 | { | 158 | { |
125 | of_pdt_build_devicetree(prom_root_node); | 159 | of_pdt_build_devicetree(prom_root_node, &prom_sparc_ops); |
126 | of_console_init(); | 160 | of_console_init(); |
127 | 161 | ||
128 | pr_info("PROM: Built device tree with %u bytes of memory.\n", | 162 | pr_info("PROM: Built device tree with %u bytes of memory.\n", |