Commit 43c0ea60 authored by Nathan Fontenot's avatar Nathan Fontenot Committed by Benjamin Herrenschmidt

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: default avatarNathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 530b5e14
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <asm/feature-fixups.h> #include <asm/feature-fixups.h>
/* firmware feature bitmask values */ /* firmware feature bitmask values */
#define FIRMWARE_MAX_FEATURES 63
#define FW_FEATURE_PFT ASM_CONST(0x0000000000000001) #define FW_FEATURE_PFT ASM_CONST(0x0000000000000001)
#define FW_FEATURE_TCE ASM_CONST(0x0000000000000002) #define FW_FEATURE_TCE ASM_CONST(0x0000000000000002)
......
...@@ -39,7 +39,7 @@ typedef struct { ...@@ -39,7 +39,7 @@ typedef struct {
* string must match. * string must match.
*/ */
static __initdata firmware_feature_t static __initdata firmware_feature_t
firmware_features_table[FIRMWARE_MAX_FEATURES] = { firmware_features_table[] = {
{FW_FEATURE_PFT, "hcall-pft"}, {FW_FEATURE_PFT, "hcall-pft"},
{FW_FEATURE_TCE, "hcall-tce"}, {FW_FEATURE_TCE, "hcall-tce"},
{FW_FEATURE_SPRG0, "hcall-sprg0"}, {FW_FEATURE_SPRG0, "hcall-sprg0"},
...@@ -77,12 +77,10 @@ void __init fw_feature_init(const char *hypertas, unsigned long len) ...@@ -77,12 +77,10 @@ void __init fw_feature_init(const char *hypertas, unsigned long len)
pr_debug(" -> fw_feature_init()\n"); pr_debug(" -> fw_feature_init()\n");
for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) { for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) { for (i = 0; i < ARRAY_SIZE(firmware_features_table); i++) {
const char *name = firmware_features_table[i].name; const char *name = firmware_features_table[i].name;
size_t size; size_t size;
/* check value against table of strings */
if (!name)
continue;
/* /*
* If there is a '*' at the end of name, only check * If there is a '*' at the end of name, only check
* upto there * upto there
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment