From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v4 5/13] Use ARRAY_SIZE to iterate over firmware_features_table array
Date: Wed, 24 Apr 2013 10:55:08 -0500 [thread overview]
Message-ID: <5178005C.1070204@linux.vnet.ibm.com> (raw)
In-Reply-To: <5177FB74.2050709@linux.vnet.ibm.com>
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>
---
arch/powerpc/include/asm/firmware.h | 1 -
arch/powerpc/platforms/pseries/firmware.c | 8 +++-----
2 files changed, 3 insertions(+), 6 deletions(-)
Index: powerpc/arch/powerpc/include/asm/firmware.h
===================================================================
--- powerpc.orig/arch/powerpc/include/asm/firmware.h 2013-04-23 14:17:16.000000000 -0500
+++ powerpc/arch/powerpc/include/asm/firmware.h 2013-04-23 14:19:54.000000000 -0500
@@ -18,7 +18,6 @@
#include <asm/feature-fixups.h>
/* firmware feature bitmask values */
-#define FIRMWARE_MAX_FEATURES 63
#define FW_FEATURE_PFT ASM_CONST(0x0000000000000001)
#define FW_FEATURE_TCE ASM_CONST(0x0000000000000002)
Index: powerpc/arch/powerpc/platforms/pseries/firmware.c
===================================================================
--- powerpc.orig/arch/powerpc/platforms/pseries/firmware.c 2013-04-23 14:17:16.000000000 -0500
+++ powerpc/arch/powerpc/platforms/pseries/firmware.c 2013-04-23 14:46:10.000000000 -0500
@@ -39,7 +39,7 @@
* string must match.
*/
static __initdata firmware_feature_t
-firmware_features_table[FIRMWARE_MAX_FEATURES] = {
+firmware_features_table[] = {
{FW_FEATURE_PFT, "hcall-pft"},
{FW_FEATURE_TCE, "hcall-tce"},
{FW_FEATURE_SPRG0, "hcall-sprg0"},
@@ -77,12 +77,10 @@
pr_debug(" -> fw_feature_init()\n");
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;
size_t size;
- /* check value against table of strings */
- if (!name)
- continue;
+
/*
* If there is a '*' at the end of name, only check
* upto there
next prev parent reply other threads:[~2013-04-24 15:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 15:34 [PATCH v4 0/13] NUMA CPU Reconfiguration using PRRN Nathan Fontenot
2013-04-24 15:47 ` [PATCH v4 1/13] Expose pseries devicetree_update() Nathan Fontenot
2013-04-24 15:49 ` [PATCH v4 2/13] Correct buffer parsing in update_dt_node() Nathan Fontenot
2013-04-26 3:01 ` Stephen Rothwell
2013-04-24 15:51 ` [PATCH v4 3/13] Add PRRN RTAS event handler Nathan Fontenot
2013-04-24 15:53 ` [PATCH v4 4/13] Move architecture vector definitions to prom.h Nathan Fontenot
2013-04-24 15:55 ` Nathan Fontenot [this message]
2013-04-26 3:08 ` [PATCH v4 5/13] Use ARRAY_SIZE to iterate over firmware_features_table array Stephen Rothwell
2013-04-24 15:57 ` [PATCH v4 6/13] Update firmware_has_feature() to check architecture vector 5 bits Nathan Fontenot
2013-04-24 15:58 ` [PATCH v4 7/13] Update numa.c to use updated firmware_has_feature() Nathan Fontenot
2013-04-24 16:00 ` [PATCH v4 8/13] Update CPU maps when device tree is updated Nathan Fontenot
2013-04-24 16:02 ` [PATCH v4 9/13] Use stop machine to update cpu maps Nathan Fontenot
2013-04-24 16:03 ` [PATCH v4 10/13] Update NUMA VDSO information when updating CPU maps Nathan Fontenot
2013-04-24 16:05 ` [PATCH v4 11/13] RE-enable Virtual Processor Home Node updating Nathan Fontenot
2013-04-24 16:06 ` [PATCH v4 12/13] Enable PRRN handling Nathan Fontenot
2013-04-24 16:07 ` [PATCH v4 13/13] Add /proc interface to control topology updates Nathan Fontenot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5178005C.1070204@linux.vnet.ibm.com \
--to=nfont@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.