diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2012-12-12 01:03:13 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 02:22:28 +0100 |
commit | fcf07d22f089856631b52a75c35ba3c33b70a1b4 (patch) | |
tree | f826fde071ac174764e12e95d903e2e0bd98734f | |
parent | bootmem: fix wrong call parameter for free_bootmem() (diff) | |
download | linux-fcf07d22f089856631b52a75c35ba3c33b70a1b4.tar.xz linux-fcf07d22f089856631b52a75c35ba3c33b70a1b4.zip |
drivers/base/node.c: cleanup node_state_attr[]
use [index] = init_value
use N_xxxxx instead of hardcode.
Make it more readability and easier to add new state.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/base/node.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c index fffed4c96bb3..294e31626210 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -638,23 +638,23 @@ static ssize_t show_node_state(struct device *dev, { __ATTR(name, 0444, show_node_state, NULL), state } static struct node_attr node_state_attr[] = { - _NODE_ATTR(possible, N_POSSIBLE), - _NODE_ATTR(online, N_ONLINE), - _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY), - _NODE_ATTR(has_cpu, N_CPU), + [N_POSSIBLE] = _NODE_ATTR(possible, N_POSSIBLE), + [N_ONLINE] = _NODE_ATTR(online, N_ONLINE), + [N_NORMAL_MEMORY] = _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY), #ifdef CONFIG_HIGHMEM - _NODE_ATTR(has_high_memory, N_HIGH_MEMORY), + [N_HIGH_MEMORY] = _NODE_ATTR(has_high_memory, N_HIGH_MEMORY), #endif + [N_CPU] = _NODE_ATTR(has_cpu, N_CPU), }; static struct attribute *node_state_attrs[] = { - &node_state_attr[0].attr.attr, - &node_state_attr[1].attr.attr, - &node_state_attr[2].attr.attr, - &node_state_attr[3].attr.attr, + &node_state_attr[N_POSSIBLE].attr.attr, + &node_state_attr[N_ONLINE].attr.attr, + &node_state_attr[N_NORMAL_MEMORY].attr.attr, #ifdef CONFIG_HIGHMEM - &node_state_attr[4].attr.attr, + &node_state_attr[N_HIGH_MEMORY].attr.attr, #endif + &node_state_attr[N_CPU].attr.attr, NULL }; |