mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-15 02:05:16 +08:00
[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>
This commit is contained in:
parent
a7cb03375d
commit
0941d57aa7
@ -263,48 +263,44 @@ static int __init pSeries_init_panel(void)
|
|||||||
arch_initcall(pSeries_init_panel);
|
arch_initcall(pSeries_init_panel);
|
||||||
|
|
||||||
|
|
||||||
/* Build up the ppc64_firmware_features bitmask field
|
/* Build up the firmware features bitmask using the contents of
|
||||||
* using contents of device-tree/ibm,hypertas-functions.
|
* device-tree/ibm,hypertas-functions. Ultimately this functionality may
|
||||||
* Ultimately this functionality may be moved into prom.c prom_init().
|
* be moved into prom.c prom_init().
|
||||||
*/
|
*/
|
||||||
static void __init fw_feature_init(void)
|
static void __init fw_feature_init(void)
|
||||||
{
|
{
|
||||||
struct device_node * dn;
|
struct device_node *dn;
|
||||||
char * hypertas;
|
char *hypertas, *s;
|
||||||
unsigned int len;
|
int len, i;
|
||||||
|
|
||||||
DBG(" -> fw_feature_init()\n");
|
DBG(" -> fw_feature_init()\n");
|
||||||
|
|
||||||
ppc64_firmware_features = 0;
|
|
||||||
dn = of_find_node_by_path("/rtas");
|
dn = of_find_node_by_path("/rtas");
|
||||||
if (dn == NULL) {
|
if (dn == NULL) {
|
||||||
printk(KERN_ERR "WARNING ! Cannot find RTAS in device-tree !\n");
|
printk(KERN_ERR "WARNING! Cannot find RTAS in device-tree!\n");
|
||||||
goto no_rtas;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
hypertas = get_property(dn, "ibm,hypertas-functions", &len);
|
hypertas = get_property(dn, "ibm,hypertas-functions", &len);
|
||||||
if (hypertas) {
|
if (hypertas == NULL)
|
||||||
while (len > 0){
|
goto out;
|
||||||
int i, hypertas_len;
|
|
||||||
|
for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
|
||||||
|
for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) {
|
||||||
/* check value against table of strings */
|
/* check value against table of strings */
|
||||||
for(i=0; i < FIRMWARE_MAX_FEATURES ;i++) {
|
if (!firmware_features_table[i].name ||
|
||||||
if ((firmware_features_table[i].name) &&
|
strcmp(firmware_features_table[i].name, s))
|
||||||
(strcmp(firmware_features_table[i].name,hypertas))==0) {
|
continue;
|
||||||
/* we have a match */
|
|
||||||
ppc64_firmware_features |=
|
/* we have a match */
|
||||||
(firmware_features_table[i].val);
|
ppc64_firmware_features |=
|
||||||
break;
|
firmware_features_table[i].val;
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
hypertas_len = strlen(hypertas);
|
|
||||||
len -= hypertas_len +1;
|
|
||||||
hypertas+= hypertas_len +1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
of_node_put(dn);
|
of_node_put(dn);
|
||||||
no_rtas:
|
|
||||||
|
|
||||||
DBG(" <- fw_feature_init()\n");
|
DBG(" <- fw_feature_init()\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user