lkml.org 
[lkml]   [2012]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC V3 PATCH 04/25] node: cleanup node_state_attr
    Date
    Make it more readability and easy to add new state.

    Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
    ---
    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 af1a177..5d7731e 100644
    --- a/drivers/base/node.c
    +++ b/drivers/base/node.c
    @@ -614,23 +614,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
    };

    --
    1.7.4.4


    \
     
     \ /
      Last update: 2012-08-06 15:22    [W:0.042 / U:29.428 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site