diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2006-02-09 23:47:32 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-02-10 00:52:02 -0500 |
commit | 0941d57aa7034ef7010bd523752c2e3bee569ef1 (patch) | |
tree | e4c710502b700bc79de4b3cd556f475413d698ae | |
parent | a7cb03375d794d3494561bbad90aeab13ff7e4d0 (diff) |
[PATCH] powerpc: Clean up pSeries firmware feature initialisation
Clean up fw_feature_init in platforms/pseries/setup.c. Clean up white space
and replace the while loop with a for loop - which seems clearer to me.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 9edeca83f434..984241bb776c 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -263,48 +263,44 @@ static int __init pSeries_init_panel(void) | |||
263 | arch_initcall(pSeries_init_panel); | 263 | arch_initcall(pSeries_init_panel); |
264 | 264 | ||
265 | 265 | ||
266 | /* Build up the ppc64_firmware_features bitmask field | 266 | /* Build up the firmware features bitmask using the contents of |
267 | * using contents of device-tree/ibm,hypertas-functions. | 267 | * device-tree/ibm,hypertas-functions. Ultimately this functionality may |
268 | * Ultimately this functionality may be moved into prom.c prom_init(). | 268 | * be moved into prom.c prom_init(). |
269 | */ | 269 | */ |
270 | static void __init fw_feature_init(void) | 270 | static void __init fw_feature_init(void) |
271 | { | 271 | { |
272 | struct device_node * dn; | 272 | struct device_node *dn; |
273 | char * hypertas; | 273 | char *hypertas, *s; |
274 | unsigned int len; | 274 | int len, i; |
275 | 275 | ||
276 | DBG(" -> fw_feature_init()\n"); | 276 | DBG(" -> fw_feature_init()\n"); |
277 | 277 | ||
278 | ppc64_firmware_features = 0; | ||
279 | dn = of_find_node_by_path("/rtas"); | 278 | dn = of_find_node_by_path("/rtas"); |
280 | if (dn == NULL) { | 279 | if (dn == NULL) { |
281 | printk(KERN_ERR "WARNING ! Cannot find RTAS in device-tree !\n"); | 280 | printk(KERN_ERR "WARNING! Cannot find RTAS in device-tree!\n"); |
282 | goto no_rtas; | 281 | goto out; |
283 | } | 282 | } |
284 | 283 | ||
285 | hypertas = get_property(dn, "ibm,hypertas-functions", &len); | 284 | hypertas = get_property(dn, "ibm,hypertas-functions", &len); |
286 | if (hypertas) { | 285 | if (hypertas == NULL) |
287 | while (len > 0){ | 286 | goto out; |
288 | int i, hypertas_len; | 287 | |
288 | for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) { | ||
289 | for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) { | ||
289 | /* check value against table of strings */ | 290 | /* check value against table of strings */ |
290 | for(i=0; i < FIRMWARE_MAX_FEATURES ;i++) { | 291 | if (!firmware_features_table[i].name || |
291 | if ((firmware_features_table[i].name) && | 292 | strcmp(firmware_features_table[i].name, s)) |
292 | (strcmp(firmware_features_table[i].name,hypertas))==0) { | 293 | continue; |
293 | /* we have a match */ | 294 | |
294 | ppc64_firmware_features |= | 295 | /* we have a match */ |
295 | (firmware_features_table[i].val); | 296 | ppc64_firmware_features |= |
296 | break; | 297 | firmware_features_table[i].val; |
297 | } | 298 | break; |
298 | } | ||
299 | hypertas_len = strlen(hypertas); | ||
300 | len -= hypertas_len +1; | ||
301 | hypertas+= hypertas_len +1; | ||
302 | } | 299 | } |
303 | } | 300 | } |
304 | 301 | ||
302 | out: | ||
305 | of_node_put(dn); | 303 | of_node_put(dn); |
306 | no_rtas: | ||
307 | |||
308 | DBG(" <- fw_feature_init()\n"); | 304 | DBG(" <- fw_feature_init()\n"); |
309 | } | 305 | } |
310 | 306 | ||