Commit fcf07d22 authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Linus Torvalds

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: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: default avatarWen Congyang <wency@cn.fujitsu.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 81df9bff
...@@ -638,23 +638,23 @@ static ssize_t show_node_state(struct device *dev, ...@@ -638,23 +638,23 @@ static ssize_t show_node_state(struct device *dev,
{ __ATTR(name, 0444, show_node_state, NULL), state } { __ATTR(name, 0444, show_node_state, NULL), state }
static struct node_attr node_state_attr[] = { static struct node_attr node_state_attr[] = {
_NODE_ATTR(possible, N_POSSIBLE), [N_POSSIBLE] = _NODE_ATTR(possible, N_POSSIBLE),
_NODE_ATTR(online, N_ONLINE), [N_ONLINE] = _NODE_ATTR(online, N_ONLINE),
_NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY), [N_NORMAL_MEMORY] = _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY),
_NODE_ATTR(has_cpu, N_CPU),
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
_NODE_ATTR(has_high_memory, N_HIGH_MEMORY), [N_HIGH_MEMORY] = _NODE_ATTR(has_high_memory, N_HIGH_MEMORY),
#endif #endif
[N_CPU] = _NODE_ATTR(has_cpu, N_CPU),
}; };
static struct attribute *node_state_attrs[] = { static struct attribute *node_state_attrs[] = {
&node_state_attr[0].attr.attr, &node_state_attr[N_POSSIBLE].attr.attr,
&node_state_attr[1].attr.attr, &node_state_attr[N_ONLINE].attr.attr,
&node_state_attr[2].attr.attr, &node_state_attr[N_NORMAL_MEMORY].attr.attr,
&node_state_attr[3].attr.attr,
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
&node_state_attr[4].attr.attr, &node_state_attr[N_HIGH_MEMORY].attr.attr,
#endif #endif
&node_state_attr[N_CPU].attr.attr,
NULL NULL
}; };
......
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