diff options
author | Nathan Fontenot <nfont@linux.vnet.ibm.com> | 2013-04-24 01:55:08 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-04-26 02:08:21 -0400 |
commit | 43c0ea60537d9423f0f1b5c14b0cd0a0b4af5c81 (patch) | |
tree | 0583e4dd038d0463ad8859f5d1ce33578d20ee45 /arch/powerpc/platforms | |
parent | 530b5e1475e5bab5d5e5d03438004ad609068146 (diff) |
powerpc/pseries: Use ARRAY_SIZE to iterate over firmware_features_table array
When iterating over the entries in firmware_features_table we only need
to go over the actual number of entries in the array instead of declaring
it to be bigger and checking to make sure there is a valid entry in every
slot.
This patch removes the FIRMWARE_MAX_FEATURES #define and replaces the
array looping with the use of ARRAY_SIZE().
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pseries/firmware.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c index aa3693f7fb27..1236a9d6146a 100644 --- a/arch/powerpc/platforms/pseries/firmware.c +++ b/arch/powerpc/platforms/pseries/firmware.c | |||
@@ -39,7 +39,7 @@ typedef struct { | |||
39 | * string must match. | 39 | * string must match. |
40 | */ | 40 | */ |
41 | static __initdata firmware_feature_t | 41 | static __initdata firmware_feature_t |
42 | firmware_features_table[FIRMWARE_MAX_FEATURES] = { | 42 | firmware_features_table[] = { |
43 | {FW_FEATURE_PFT, "hcall-pft"}, | 43 | {FW_FEATURE_PFT, "hcall-pft"}, |
44 | {FW_FEATURE_TCE, "hcall-tce"}, | 44 | {FW_FEATURE_TCE, "hcall-tce"}, |
45 | {FW_FEATURE_SPRG0, "hcall-sprg0"}, | 45 | {FW_FEATURE_SPRG0, "hcall-sprg0"}, |
@@ -77,12 +77,10 @@ void __init fw_feature_init(const char *hypertas, unsigned long len) | |||
77 | pr_debug(" -> fw_feature_init()\n"); | 77 | pr_debug(" -> fw_feature_init()\n"); |
78 | 78 | ||
79 | for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) { | 79 | for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) { |
80 | for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) { | 80 | for (i = 0; i < ARRAY_SIZE(firmware_features_table); i++) { |
81 | const char *name = firmware_features_table[i].name; | 81 | const char *name = firmware_features_table[i].name; |
82 | size_t size; | 82 | size_t size; |
83 | /* check value against table of strings */ | 83 | |
84 | if (!name) | ||
85 | continue; | ||
86 | /* | 84 | /* |
87 | * If there is a '*' at the end of name, only check | 85 | * If there is a '*' at the end of name, only check |
88 | * upto there | 86 | * upto there |