diff options
Diffstat (limited to 'drivers/base/node.c')
-rw-r--r-- | drivers/base/node.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c index aa8bc4bff4f6..ad43185ec15a 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
@@ -16,8 +16,11 @@ | |||
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/swap.h> | 17 | #include <linux/swap.h> |
18 | 18 | ||
19 | static struct sysdev_class_attribute *node_state_attrs[]; | ||
20 | |||
19 | static struct sysdev_class node_class = { | 21 | static struct sysdev_class node_class = { |
20 | .name = "node", | 22 | .name = "node", |
23 | .attrs = node_state_attrs, | ||
21 | }; | 24 | }; |
22 | 25 | ||
23 | 26 | ||
@@ -569,29 +572,27 @@ static struct node_attr node_state_attr[] = { | |||
569 | #endif | 572 | #endif |
570 | }; | 573 | }; |
571 | 574 | ||
572 | static int node_states_init(void) | 575 | static struct sysdev_class_attribute *node_state_attrs[] = { |
573 | { | 576 | &node_state_attr[0].attr, |
574 | int i; | 577 | &node_state_attr[1].attr, |
575 | int err = 0; | 578 | &node_state_attr[2].attr, |
576 | 579 | &node_state_attr[3].attr, | |
577 | BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES); | 580 | #ifdef CONFIG_HIGHMEM |
578 | for (i = 0; i < NR_NODE_STATES; i++) { | 581 | &node_state_attr[4].attr, |
579 | int ret; | 582 | #endif |
580 | ret = sysdev_class_create_file(&node_class, &node_state_attr[i].attr); | 583 | NULL |
581 | if (!err) | 584 | }; |
582 | err = ret; | ||
583 | } | ||
584 | return err; | ||
585 | } | ||
586 | 585 | ||
587 | #define NODE_CALLBACK_PRI 2 /* lower than SLAB */ | 586 | #define NODE_CALLBACK_PRI 2 /* lower than SLAB */ |
588 | static int __init register_node_type(void) | 587 | static int __init register_node_type(void) |
589 | { | 588 | { |
590 | int ret; | 589 | int ret; |
591 | 590 | ||
591 | BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES); | ||
592 | BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES); | ||
593 | |||
592 | ret = sysdev_class_register(&node_class); | 594 | ret = sysdev_class_register(&node_class); |
593 | if (!ret) { | 595 | if (!ret) { |
594 | ret = node_states_init(); | ||
595 | hotplug_memory_notifier(node_memory_callback, | 596 | hotplug_memory_notifier(node_memory_callback, |
596 | NODE_CALLBACK_PRI); | 597 | NODE_CALLBACK_PRI); |
597 | } | 598 | } |