aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/sysfs.c4
-rw-r--r--drivers/base/memory.c160
-rw-r--r--drivers/base/node.c146
-rw-r--r--include/linux/memory.h3
-rw-r--r--include/linux/node.h6
-rw-r--r--mm/compaction.c10
-rw-r--r--mm/hugetlb.c34
-rw-r--r--mm/vmscan.c14
8 files changed, 177 insertions, 200 deletions
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index f396ef27916b..5e7c1655f13a 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -592,7 +592,7 @@ static void register_nodes(void)
592int sysfs_add_device_to_node(struct device *dev, int nid) 592int sysfs_add_device_to_node(struct device *dev, int nid)
593{ 593{
594 struct node *node = &node_devices[nid]; 594 struct node *node = &node_devices[nid];
595 return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, 595 return sysfs_create_link(&node->dev.kobj, &dev->kobj,
596 kobject_name(&dev->kobj)); 596 kobject_name(&dev->kobj));
597} 597}
598EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); 598EXPORT_SYMBOL_GPL(sysfs_add_device_to_node);
@@ -600,7 +600,7 @@ EXPORT_SYMBOL_GPL(sysfs_add_device_to_node);
600void sysfs_remove_device_from_node(struct device *dev, int nid) 600void sysfs_remove_device_from_node(struct device *dev, int nid)
601{ 601{
602 struct node *node = &node_devices[nid]; 602 struct node *node = &node_devices[nid];
603 sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); 603 sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj));
604} 604}
605EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); 605EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node);
606 606
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 8272d92d22c0..f17e3ea041c0 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * drivers/base/memory.c - basic Memory class support 2 * Memory subsystem support
3 * 3 *
4 * Written by Matt Tolentino <matthew.e.tolentino@intel.com> 4 * Written by Matt Tolentino <matthew.e.tolentino@intel.com>
5 * Dave Hansen <haveblue@us.ibm.com> 5 * Dave Hansen <haveblue@us.ibm.com>
@@ -10,7 +10,6 @@
10 * SPARSEMEM should be contained here, or in mm/memory_hotplug.c. 10 * SPARSEMEM should be contained here, or in mm/memory_hotplug.c.
11 */ 11 */
12 12
13#include <linux/sysdev.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <linux/init.h> 14#include <linux/init.h>
16#include <linux/topology.h> 15#include <linux/topology.h>
@@ -38,26 +37,9 @@ static inline int base_memory_block_id(int section_nr)
38 return section_nr / sections_per_block; 37 return section_nr / sections_per_block;
39} 38}
40 39
41static struct sysdev_class memory_sysdev_class = { 40static struct bus_type memory_subsys = {
42 .name = MEMORY_CLASS_NAME, 41 .name = MEMORY_CLASS_NAME,
43}; 42 .dev_name = MEMORY_CLASS_NAME,
44
45static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
46{
47 return MEMORY_CLASS_NAME;
48}
49
50static int memory_uevent(struct kset *kset, struct kobject *obj,
51 struct kobj_uevent_env *env)
52{
53 int retval = 0;
54
55 return retval;
56}
57
58static const struct kset_uevent_ops memory_uevent_ops = {
59 .name = memory_uevent_name,
60 .uevent = memory_uevent,
61}; 43};
62 44
63static BLOCKING_NOTIFIER_HEAD(memory_chain); 45static BLOCKING_NOTIFIER_HEAD(memory_chain);
@@ -96,21 +78,21 @@ int register_memory(struct memory_block *memory)
96{ 78{
97 int error; 79 int error;
98 80
99 memory->sysdev.cls = &memory_sysdev_class; 81 memory->dev.bus = &memory_subsys;
100 memory->sysdev.id = memory->start_section_nr / sections_per_block; 82 memory->dev.id = memory->start_section_nr / sections_per_block;
101 83
102 error = sysdev_register(&memory->sysdev); 84 error = device_register(&memory->dev);
103 return error; 85 return error;
104} 86}
105 87
106static void 88static void
107unregister_memory(struct memory_block *memory) 89unregister_memory(struct memory_block *memory)
108{ 90{
109 BUG_ON(memory->sysdev.cls != &memory_sysdev_class); 91 BUG_ON(memory->dev.bus != &memory_subsys);
110 92
111 /* drop the ref. we got in remove_memory_block() */ 93 /* drop the ref. we got in remove_memory_block() */
112 kobject_put(&memory->sysdev.kobj); 94 kobject_put(&memory->dev.kobj);
113 sysdev_unregister(&memory->sysdev); 95 device_unregister(&memory->dev);
114} 96}
115 97
116unsigned long __weak memory_block_size_bytes(void) 98unsigned long __weak memory_block_size_bytes(void)
@@ -138,22 +120,22 @@ static unsigned long get_memory_block_size(void)
138 * uses. 120 * uses.
139 */ 121 */
140 122
141static ssize_t show_mem_start_phys_index(struct sys_device *dev, 123static ssize_t show_mem_start_phys_index(struct device *dev,
142 struct sysdev_attribute *attr, char *buf) 124 struct device_attribute *attr, char *buf)
143{ 125{
144 struct memory_block *mem = 126 struct memory_block *mem =
145 container_of(dev, struct memory_block, sysdev); 127 container_of(dev, struct memory_block, dev);
146 unsigned long phys_index; 128 unsigned long phys_index;
147 129
148 phys_index = mem->start_section_nr / sections_per_block; 130 phys_index = mem->start_section_nr / sections_per_block;
149 return sprintf(buf, "%08lx\n", phys_index); 131 return sprintf(buf, "%08lx\n", phys_index);
150} 132}
151 133
152static ssize_t show_mem_end_phys_index(struct sys_device *dev, 134static ssize_t show_mem_end_phys_index(struct device *dev,
153 struct sysdev_attribute *attr, char *buf) 135 struct device_attribute *attr, char *buf)
154{ 136{
155 struct memory_block *mem = 137 struct memory_block *mem =
156 container_of(dev, struct memory_block, sysdev); 138 container_of(dev, struct memory_block, dev);
157 unsigned long phys_index; 139 unsigned long phys_index;
158 140
159 phys_index = mem->end_section_nr / sections_per_block; 141 phys_index = mem->end_section_nr / sections_per_block;
@@ -163,13 +145,13 @@ static ssize_t show_mem_end_phys_index(struct sys_device *dev,
163/* 145/*
164 * Show whether the section of memory is likely to be hot-removable 146 * Show whether the section of memory is likely to be hot-removable
165 */ 147 */
166static ssize_t show_mem_removable(struct sys_device *dev, 148static ssize_t show_mem_removable(struct device *dev,
167 struct sysdev_attribute *attr, char *buf) 149 struct device_attribute *attr, char *buf)
168{ 150{
169 unsigned long i, pfn; 151 unsigned long i, pfn;
170 int ret = 1; 152 int ret = 1;
171 struct memory_block *mem = 153 struct memory_block *mem =
172 container_of(dev, struct memory_block, sysdev); 154 container_of(dev, struct memory_block, dev);
173 155
174 for (i = 0; i < sections_per_block; i++) { 156 for (i = 0; i < sections_per_block; i++) {
175 pfn = section_nr_to_pfn(mem->start_section_nr + i); 157 pfn = section_nr_to_pfn(mem->start_section_nr + i);
@@ -182,11 +164,11 @@ static ssize_t show_mem_removable(struct sys_device *dev,
182/* 164/*
183 * online, offline, going offline, etc. 165 * online, offline, going offline, etc.
184 */ 166 */
185static ssize_t show_mem_state(struct sys_device *dev, 167static ssize_t show_mem_state(struct device *dev,
186 struct sysdev_attribute *attr, char *buf) 168 struct device_attribute *attr, char *buf)
187{ 169{
188 struct memory_block *mem = 170 struct memory_block *mem =
189 container_of(dev, struct memory_block, sysdev); 171 container_of(dev, struct memory_block, dev);
190 ssize_t len = 0; 172 ssize_t len = 0;
191 173
192 /* 174 /*
@@ -324,13 +306,13 @@ out:
324} 306}
325 307
326static ssize_t 308static ssize_t
327store_mem_state(struct sys_device *dev, 309store_mem_state(struct device *dev,
328 struct sysdev_attribute *attr, const char *buf, size_t count) 310 struct device_attribute *attr, const char *buf, size_t count)
329{ 311{
330 struct memory_block *mem; 312 struct memory_block *mem;
331 int ret = -EINVAL; 313 int ret = -EINVAL;
332 314
333 mem = container_of(dev, struct memory_block, sysdev); 315 mem = container_of(dev, struct memory_block, dev);
334 316
335 if (!strncmp(buf, "online", min((int)count, 6))) 317 if (!strncmp(buf, "online", min((int)count, 6)))
336 ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); 318 ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE);
@@ -351,41 +333,41 @@ store_mem_state(struct sys_device *dev,
351 * s.t. if I offline all of these sections I can then 333 * s.t. if I offline all of these sections I can then
352 * remove the physical device? 334 * remove the physical device?
353 */ 335 */
354static ssize_t show_phys_device(struct sys_device *dev, 336static ssize_t show_phys_device(struct device *dev,
355 struct sysdev_attribute *attr, char *buf) 337 struct device_attribute *attr, char *buf)
356{ 338{
357 struct memory_block *mem = 339 struct memory_block *mem =
358 container_of(dev, struct memory_block, sysdev); 340 container_of(dev, struct memory_block, dev);
359 return sprintf(buf, "%d\n", mem->phys_device); 341 return sprintf(buf, "%d\n", mem->phys_device);
360} 342}
361 343
362static SYSDEV_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL); 344static DEVICE_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL);
363static SYSDEV_ATTR(end_phys_index, 0444, show_mem_end_phys_index, NULL); 345static DEVICE_ATTR(end_phys_index, 0444, show_mem_end_phys_index, NULL);
364static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state); 346static DEVICE_ATTR(state, 0644, show_mem_state, store_mem_state);
365static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL); 347static DEVICE_ATTR(phys_device, 0444, show_phys_device, NULL);
366static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL); 348static DEVICE_ATTR(removable, 0444, show_mem_removable, NULL);
367 349
368#define mem_create_simple_file(mem, attr_name) \ 350#define mem_create_simple_file(mem, attr_name) \
369 sysdev_create_file(&mem->sysdev, &attr_##attr_name) 351 device_create_file(&mem->dev, &dev_attr_##attr_name)
370#define mem_remove_simple_file(mem, attr_name) \ 352#define mem_remove_simple_file(mem, attr_name) \
371 sysdev_remove_file(&mem->sysdev, &attr_##attr_name) 353 device_remove_file(&mem->dev, &dev_attr_##attr_name)
372 354
373/* 355/*
374 * Block size attribute stuff 356 * Block size attribute stuff
375 */ 357 */
376static ssize_t 358static ssize_t
377print_block_size(struct sysdev_class *class, struct sysdev_class_attribute *attr, 359print_block_size(struct device *dev, struct device_attribute *attr,
378 char *buf) 360 char *buf)
379{ 361{
380 return sprintf(buf, "%lx\n", get_memory_block_size()); 362 return sprintf(buf, "%lx\n", get_memory_block_size());
381} 363}
382 364
383static SYSDEV_CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); 365static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL);
384 366
385static int block_size_init(void) 367static int block_size_init(void)
386{ 368{
387 return sysfs_create_file(&memory_sysdev_class.kset.kobj, 369 return device_create_file(memory_subsys.dev_root,
388 &attr_block_size_bytes.attr); 370 &dev_attr_block_size_bytes);
389} 371}
390 372
391/* 373/*
@@ -396,7 +378,7 @@ static int block_size_init(void)
396 */ 378 */
397#ifdef CONFIG_ARCH_MEMORY_PROBE 379#ifdef CONFIG_ARCH_MEMORY_PROBE
398static ssize_t 380static ssize_t
399memory_probe_store(struct class *class, struct class_attribute *attr, 381memory_probe_store(struct device *dev, struct device_attribute *attr,
400 const char *buf, size_t count) 382 const char *buf, size_t count)
401{ 383{
402 u64 phys_addr; 384 u64 phys_addr;
@@ -423,12 +405,11 @@ memory_probe_store(struct class *class, struct class_attribute *attr,
423out: 405out:
424 return ret; 406 return ret;
425} 407}
426static CLASS_ATTR(probe, S_IWUSR, NULL, memory_probe_store); 408static DEVICE_ATTR(probe, S_IWUSR, NULL, memory_probe_store);
427 409
428static int memory_probe_init(void) 410static int memory_probe_init(void)
429{ 411{
430 return sysfs_create_file(&memory_sysdev_class.kset.kobj, 412 return device_create_file(memory_subsys.dev_root, &dev_attr_probe);
431 &class_attr_probe.attr);
432} 413}
433#else 414#else
434static inline int memory_probe_init(void) 415static inline int memory_probe_init(void)
@@ -444,8 +425,8 @@ static inline int memory_probe_init(void)
444 425
445/* Soft offline a page */ 426/* Soft offline a page */
446static ssize_t 427static ssize_t
447store_soft_offline_page(struct class *class, 428store_soft_offline_page(struct device *dev,
448 struct class_attribute *attr, 429 struct device_attribute *attr,
449 const char *buf, size_t count) 430 const char *buf, size_t count)
450{ 431{
451 int ret; 432 int ret;
@@ -463,8 +444,8 @@ store_soft_offline_page(struct class *class,
463 444
464/* Forcibly offline a page, including killing processes. */ 445/* Forcibly offline a page, including killing processes. */
465static ssize_t 446static ssize_t
466store_hard_offline_page(struct class *class, 447store_hard_offline_page(struct device *dev,
467 struct class_attribute *attr, 448 struct device_attribute *attr,
468 const char *buf, size_t count) 449 const char *buf, size_t count)
469{ 450{
470 int ret; 451 int ret;
@@ -478,18 +459,18 @@ store_hard_offline_page(struct class *class,
478 return ret ? ret : count; 459 return ret ? ret : count;
479} 460}
480 461
481static CLASS_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page); 462static DEVICE_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page);
482static CLASS_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page); 463static DEVICE_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page);
483 464
484static __init int memory_fail_init(void) 465static __init int memory_fail_init(void)
485{ 466{
486 int err; 467 int err;
487 468
488 err = sysfs_create_file(&memory_sysdev_class.kset.kobj, 469 err = device_create_file(memory_subsys.dev_root,
489 &class_attr_soft_offline_page.attr); 470 &dev_attr_soft_offline_page);
490 if (!err) 471 if (!err)
491 err = sysfs_create_file(&memory_sysdev_class.kset.kobj, 472 err = device_create_file(memory_subsys.dev_root,
492 &class_attr_hard_offline_page.attr); 473 &dev_attr_hard_offline_page);
493 return err; 474 return err;
494} 475}
495#else 476#else
@@ -509,31 +490,23 @@ int __weak arch_get_memory_phys_device(unsigned long start_pfn)
509 return 0; 490 return 0;
510} 491}
511 492
493/*
494 * A reference for the returned object is held and the reference for the
495 * hinted object is released.
496 */
512struct memory_block *find_memory_block_hinted(struct mem_section *section, 497struct memory_block *find_memory_block_hinted(struct mem_section *section,
513 struct memory_block *hint) 498 struct memory_block *hint)
514{ 499{
515 struct kobject *kobj;
516 struct sys_device *sysdev;
517 struct memory_block *mem;
518 char name[sizeof(MEMORY_CLASS_NAME) + 9 + 1];
519 int block_id = base_memory_block_id(__section_nr(section)); 500 int block_id = base_memory_block_id(__section_nr(section));
501 struct device *hintdev = hint ? &hint->dev : NULL;
502 struct device *dev;
520 503
521 kobj = hint ? &hint->sysdev.kobj : NULL; 504 dev = subsys_find_device_by_id(&memory_subsys, block_id, hintdev);
522 505 if (hint)
523 /* 506 put_device(&hint->dev);
524 * This only works because we know that section == sysdev->id 507 if (!dev)
525 * slightly redundant with sysdev_register()
526 */
527 sprintf(&name[0], "%s%d", MEMORY_CLASS_NAME, block_id);
528
529 kobj = kset_find_obj_hinted(&memory_sysdev_class.kset, name, kobj);
530 if (!kobj)
531 return NULL; 508 return NULL;
532 509 return container_of(dev, struct memory_block, dev);
533 sysdev = container_of(kobj, struct sys_device, kobj);
534 mem = container_of(sysdev, struct memory_block, sysdev);
535
536 return mem;
537} 510}
538 511
539/* 512/*
@@ -542,7 +515,7 @@ struct memory_block *find_memory_block_hinted(struct mem_section *section,
542 * this gets to be a real problem, we can always use a radix 515 * this gets to be a real problem, we can always use a radix
543 * tree or something here. 516 * tree or something here.
544 * 517 *
545 * This could be made generic for all sysdev classes. 518 * This could be made generic for all device subsystems.
546 */ 519 */
547struct memory_block *find_memory_block(struct mem_section *section) 520struct memory_block *find_memory_block(struct mem_section *section)
548{ 521{
@@ -598,7 +571,7 @@ static int add_memory_section(int nid, struct mem_section *section,
598 mem = find_memory_block(section); 571 mem = find_memory_block(section);
599 if (mem) { 572 if (mem) {
600 mem->section_count++; 573 mem->section_count++;
601 kobject_put(&mem->sysdev.kobj); 574 kobject_put(&mem->dev.kobj);
602 } else 575 } else
603 ret = init_memory_block(&mem, section, state); 576 ret = init_memory_block(&mem, section, state);
604 577
@@ -631,7 +604,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section,
631 unregister_memory(mem); 604 unregister_memory(mem);
632 kfree(mem); 605 kfree(mem);
633 } else 606 } else
634 kobject_put(&mem->sysdev.kobj); 607 kobject_put(&mem->dev.kobj);
635 608
636 mutex_unlock(&mem_sysfs_mutex); 609 mutex_unlock(&mem_sysfs_mutex);
637 return 0; 610 return 0;
@@ -664,8 +637,7 @@ int __init memory_dev_init(void)
664 int err; 637 int err;
665 unsigned long block_sz; 638 unsigned long block_sz;
666 639
667 memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops; 640 ret = subsys_system_register(&memory_subsys, NULL);
668 ret = sysdev_class_register(&memory_sysdev_class);
669 if (ret) 641 if (ret)
670 goto out; 642 goto out;
671 643
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 6ce1501c7de5..996d2189689b 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * drivers/base/node.c - basic Node class support 2 * Basic Node interface support
3 */ 3 */
4 4
5#include <linux/sysdev.h>
6#include <linux/module.h> 5#include <linux/module.h>
7#include <linux/init.h> 6#include <linux/init.h>
8#include <linux/mm.h> 7#include <linux/mm.h>
@@ -19,18 +18,16 @@
19#include <linux/swap.h> 18#include <linux/swap.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
21 20
22static struct sysdev_class_attribute *node_state_attrs[]; 21static struct bus_type node_subsys = {
23
24static struct sysdev_class node_class = {
25 .name = "node", 22 .name = "node",
26 .attrs = node_state_attrs, 23 .dev_name = "node",
27}; 24};
28 25
29 26
30static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf) 27static ssize_t node_read_cpumap(struct device *dev, int type, char *buf)
31{ 28{
32 struct node *node_dev = to_node(dev); 29 struct node *node_dev = to_node(dev);
33 const struct cpumask *mask = cpumask_of_node(node_dev->sysdev.id); 30 const struct cpumask *mask = cpumask_of_node(node_dev->dev.id);
34 int len; 31 int len;
35 32
36 /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */ 33 /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */
@@ -44,23 +41,23 @@ static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf)
44 return len; 41 return len;
45} 42}
46 43
47static inline ssize_t node_read_cpumask(struct sys_device *dev, 44static inline ssize_t node_read_cpumask(struct device *dev,
48 struct sysdev_attribute *attr, char *buf) 45 struct device_attribute *attr, char *buf)
49{ 46{
50 return node_read_cpumap(dev, 0, buf); 47 return node_read_cpumap(dev, 0, buf);
51} 48}
52static inline ssize_t node_read_cpulist(struct sys_device *dev, 49static inline ssize_t node_read_cpulist(struct device *dev,
53 struct sysdev_attribute *attr, char *buf) 50 struct device_attribute *attr, char *buf)
54{ 51{
55 return node_read_cpumap(dev, 1, buf); 52 return node_read_cpumap(dev, 1, buf);
56} 53}
57 54
58static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); 55static DEVICE_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL);
59static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); 56static DEVICE_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL);
60 57
61#define K(x) ((x) << (PAGE_SHIFT - 10)) 58#define K(x) ((x) << (PAGE_SHIFT - 10))
62static ssize_t node_read_meminfo(struct sys_device * dev, 59static ssize_t node_read_meminfo(struct device *dev,
63 struct sysdev_attribute *attr, char * buf) 60 struct device_attribute *attr, char *buf)
64{ 61{
65 int n; 62 int n;
66 int nid = dev->id; 63 int nid = dev->id;
@@ -155,10 +152,10 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
155} 152}
156 153
157#undef K 154#undef K
158static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); 155static DEVICE_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL);
159 156
160static ssize_t node_read_numastat(struct sys_device * dev, 157static ssize_t node_read_numastat(struct device *dev,
161 struct sysdev_attribute *attr, char * buf) 158 struct device_attribute *attr, char *buf)
162{ 159{
163 return sprintf(buf, 160 return sprintf(buf,
164 "numa_hit %lu\n" 161 "numa_hit %lu\n"
@@ -174,10 +171,10 @@ static ssize_t node_read_numastat(struct sys_device * dev,
174 node_page_state(dev->id, NUMA_LOCAL), 171 node_page_state(dev->id, NUMA_LOCAL),
175 node_page_state(dev->id, NUMA_OTHER)); 172 node_page_state(dev->id, NUMA_OTHER));
176} 173}
177static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); 174static DEVICE_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
178 175
179static ssize_t node_read_vmstat(struct sys_device *dev, 176static ssize_t node_read_vmstat(struct device *dev,
180 struct sysdev_attribute *attr, char *buf) 177 struct device_attribute *attr, char *buf)
181{ 178{
182 int nid = dev->id; 179 int nid = dev->id;
183 int i; 180 int i;
@@ -189,10 +186,10 @@ static ssize_t node_read_vmstat(struct sys_device *dev,
189 186
190 return n; 187 return n;
191} 188}
192static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); 189static DEVICE_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);
193 190
194static ssize_t node_read_distance(struct sys_device * dev, 191static ssize_t node_read_distance(struct device *dev,
195 struct sysdev_attribute *attr, char * buf) 192 struct device_attribute *attr, char * buf)
196{ 193{
197 int nid = dev->id; 194 int nid = dev->id;
198 int len = 0; 195 int len = 0;
@@ -210,7 +207,7 @@ static ssize_t node_read_distance(struct sys_device * dev,
210 len += sprintf(buf + len, "\n"); 207 len += sprintf(buf + len, "\n");
211 return len; 208 return len;
212} 209}
213static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL); 210static DEVICE_ATTR(distance, S_IRUGO, node_read_distance, NULL);
214 211
215#ifdef CONFIG_HUGETLBFS 212#ifdef CONFIG_HUGETLBFS
216/* 213/*
@@ -228,7 +225,7 @@ static node_registration_func_t __hugetlb_unregister_node;
228static inline bool hugetlb_register_node(struct node *node) 225static inline bool hugetlb_register_node(struct node *node)
229{ 226{
230 if (__hugetlb_register_node && 227 if (__hugetlb_register_node &&
231 node_state(node->sysdev.id, N_HIGH_MEMORY)) { 228 node_state(node->dev.id, N_HIGH_MEMORY)) {
232 __hugetlb_register_node(node); 229 __hugetlb_register_node(node);
233 return true; 230 return true;
234 } 231 }
@@ -264,17 +261,17 @@ int register_node(struct node *node, int num, struct node *parent)
264{ 261{
265 int error; 262 int error;
266 263
267 node->sysdev.id = num; 264 node->dev.id = num;
268 node->sysdev.cls = &node_class; 265 node->dev.bus = &node_subsys;
269 error = sysdev_register(&node->sysdev); 266 error = device_register(&node->dev);
270 267
271 if (!error){ 268 if (!error){
272 sysdev_create_file(&node->sysdev, &attr_cpumap); 269 device_create_file(&node->dev, &dev_attr_cpumap);
273 sysdev_create_file(&node->sysdev, &attr_cpulist); 270 device_create_file(&node->dev, &dev_attr_cpulist);
274 sysdev_create_file(&node->sysdev, &attr_meminfo); 271 device_create_file(&node->dev, &dev_attr_meminfo);
275 sysdev_create_file(&node->sysdev, &attr_numastat); 272 device_create_file(&node->dev, &dev_attr_numastat);
276 sysdev_create_file(&node->sysdev, &attr_distance); 273 device_create_file(&node->dev, &dev_attr_distance);
277 sysdev_create_file(&node->sysdev, &attr_vmstat); 274 device_create_file(&node->dev, &dev_attr_vmstat);
278 275
279 scan_unevictable_register_node(node); 276 scan_unevictable_register_node(node);
280 277
@@ -294,17 +291,17 @@ int register_node(struct node *node, int num, struct node *parent)
294 */ 291 */
295void unregister_node(struct node *node) 292void unregister_node(struct node *node)
296{ 293{
297 sysdev_remove_file(&node->sysdev, &attr_cpumap); 294 device_remove_file(&node->dev, &dev_attr_cpumap);
298 sysdev_remove_file(&node->sysdev, &attr_cpulist); 295 device_remove_file(&node->dev, &dev_attr_cpulist);
299 sysdev_remove_file(&node->sysdev, &attr_meminfo); 296 device_remove_file(&node->dev, &dev_attr_meminfo);
300 sysdev_remove_file(&node->sysdev, &attr_numastat); 297 device_remove_file(&node->dev, &dev_attr_numastat);
301 sysdev_remove_file(&node->sysdev, &attr_distance); 298 device_remove_file(&node->dev, &dev_attr_distance);
302 sysdev_remove_file(&node->sysdev, &attr_vmstat); 299 device_remove_file(&node->dev, &dev_attr_vmstat);
303 300
304 scan_unevictable_unregister_node(node); 301 scan_unevictable_unregister_node(node);
305 hugetlb_unregister_node(node); /* no-op, if memoryless node */ 302 hugetlb_unregister_node(node); /* no-op, if memoryless node */
306 303
307 sysdev_unregister(&node->sysdev); 304 device_unregister(&node->dev);
308} 305}
309 306
310struct node node_devices[MAX_NUMNODES]; 307struct node node_devices[MAX_NUMNODES];
@@ -324,15 +321,15 @@ int register_cpu_under_node(unsigned int cpu, unsigned int nid)
324 if (!obj) 321 if (!obj)
325 return 0; 322 return 0;
326 323
327 ret = sysfs_create_link(&node_devices[nid].sysdev.kobj, 324 ret = sysfs_create_link(&node_devices[nid].dev.kobj,
328 &obj->kobj, 325 &obj->kobj,
329 kobject_name(&obj->kobj)); 326 kobject_name(&obj->kobj));
330 if (ret) 327 if (ret)
331 return ret; 328 return ret;
332 329
333 return sysfs_create_link(&obj->kobj, 330 return sysfs_create_link(&obj->kobj,
334 &node_devices[nid].sysdev.kobj, 331 &node_devices[nid].dev.kobj,
335 kobject_name(&node_devices[nid].sysdev.kobj)); 332 kobject_name(&node_devices[nid].dev.kobj));
336} 333}
337 334
338int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) 335int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
@@ -346,10 +343,10 @@ int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
346 if (!obj) 343 if (!obj)
347 return 0; 344 return 0;
348 345
349 sysfs_remove_link(&node_devices[nid].sysdev.kobj, 346 sysfs_remove_link(&node_devices[nid].dev.kobj,
350 kobject_name(&obj->kobj)); 347 kobject_name(&obj->kobj));
351 sysfs_remove_link(&obj->kobj, 348 sysfs_remove_link(&obj->kobj,
352 kobject_name(&node_devices[nid].sysdev.kobj)); 349 kobject_name(&node_devices[nid].dev.kobj));
353 350
354 return 0; 351 return 0;
355} 352}
@@ -391,15 +388,15 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
391 continue; 388 continue;
392 if (page_nid != nid) 389 if (page_nid != nid)
393 continue; 390 continue;
394 ret = sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj, 391 ret = sysfs_create_link_nowarn(&node_devices[nid].dev.kobj,
395 &mem_blk->sysdev.kobj, 392 &mem_blk->dev.kobj,
396 kobject_name(&mem_blk->sysdev.kobj)); 393 kobject_name(&mem_blk->dev.kobj));
397 if (ret) 394 if (ret)
398 return ret; 395 return ret;
399 396
400 return sysfs_create_link_nowarn(&mem_blk->sysdev.kobj, 397 return sysfs_create_link_nowarn(&mem_blk->dev.kobj,
401 &node_devices[nid].sysdev.kobj, 398 &node_devices[nid].dev.kobj,
402 kobject_name(&node_devices[nid].sysdev.kobj)); 399 kobject_name(&node_devices[nid].dev.kobj));
403 } 400 }
404 /* mem section does not span the specified node */ 401 /* mem section does not span the specified node */
405 return 0; 402 return 0;
@@ -432,10 +429,10 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
432 continue; 429 continue;
433 if (node_test_and_set(nid, *unlinked_nodes)) 430 if (node_test_and_set(nid, *unlinked_nodes))
434 continue; 431 continue;
435 sysfs_remove_link(&node_devices[nid].sysdev.kobj, 432 sysfs_remove_link(&node_devices[nid].dev.kobj,
436 kobject_name(&mem_blk->sysdev.kobj)); 433 kobject_name(&mem_blk->dev.kobj));
437 sysfs_remove_link(&mem_blk->sysdev.kobj, 434 sysfs_remove_link(&mem_blk->dev.kobj,
438 kobject_name(&node_devices[nid].sysdev.kobj)); 435 kobject_name(&node_devices[nid].dev.kobj));
439 } 436 }
440 NODEMASK_FREE(unlinked_nodes); 437 NODEMASK_FREE(unlinked_nodes);
441 return 0; 438 return 0;
@@ -466,7 +463,7 @@ static int link_mem_sections(int nid)
466 } 463 }
467 464
468 if (mem_blk) 465 if (mem_blk)
469 kobject_put(&mem_blk->sysdev.kobj); 466 kobject_put(&mem_blk->dev.kobj);
470 return err; 467 return err;
471} 468}
472 469
@@ -594,19 +591,19 @@ static ssize_t print_nodes_state(enum node_states state, char *buf)
594} 591}
595 592
596struct node_attr { 593struct node_attr {
597 struct sysdev_class_attribute attr; 594 struct device_attribute attr;
598 enum node_states state; 595 enum node_states state;
599}; 596};
600 597
601static ssize_t show_node_state(struct sysdev_class *class, 598static ssize_t show_node_state(struct device *dev,
602 struct sysdev_class_attribute *attr, char *buf) 599 struct device_attribute *attr, char *buf)
603{ 600{
604 struct node_attr *na = container_of(attr, struct node_attr, attr); 601 struct node_attr *na = container_of(attr, struct node_attr, attr);
605 return print_nodes_state(na->state, buf); 602 return print_nodes_state(na->state, buf);
606} 603}
607 604
608#define _NODE_ATTR(name, state) \ 605#define _NODE_ATTR(name, state) \
609 { _SYSDEV_CLASS_ATTR(name, 0444, show_node_state, NULL), state } 606 { __ATTR(name, 0444, show_node_state, NULL), state }
610 607
611static struct node_attr node_state_attr[] = { 608static struct node_attr node_state_attr[] = {
612 _NODE_ATTR(possible, N_POSSIBLE), 609 _NODE_ATTR(possible, N_POSSIBLE),
@@ -618,17 +615,26 @@ static struct node_attr node_state_attr[] = {
618#endif 615#endif
619}; 616};
620 617
621static struct sysdev_class_attribute *node_state_attrs[] = { 618static struct attribute *node_state_attrs[] = {
622 &node_state_attr[0].attr, 619 &node_state_attr[0].attr.attr,
623 &node_state_attr[1].attr, 620 &node_state_attr[1].attr.attr,
624 &node_state_attr[2].attr, 621 &node_state_attr[2].attr.attr,
625 &node_state_attr[3].attr, 622 &node_state_attr[3].attr.attr,
626#ifdef CONFIG_HIGHMEM 623#ifdef CONFIG_HIGHMEM
627 &node_state_attr[4].attr, 624 &node_state_attr[4].attr.attr,
628#endif 625#endif
629 NULL 626 NULL
630}; 627};
631 628
629static struct attribute_group memory_root_attr_group = {
630 .attrs = node_state_attrs,
631};
632
633static const struct attribute_group *cpu_root_attr_groups[] = {
634 &memory_root_attr_group,
635 NULL,
636};
637
632#define NODE_CALLBACK_PRI 2 /* lower than SLAB */ 638#define NODE_CALLBACK_PRI 2 /* lower than SLAB */
633static int __init register_node_type(void) 639static int __init register_node_type(void)
634{ 640{
@@ -637,7 +643,7 @@ static int __init register_node_type(void)
637 BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES); 643 BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES);
638 BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES); 644 BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES);
639 645
640 ret = sysdev_class_register(&node_class); 646 ret = subsys_system_register(&node_subsys, cpu_root_attr_groups);
641 if (!ret) { 647 if (!ret) {
642 hotplug_memory_notifier(node_memory_callback, 648 hotplug_memory_notifier(node_memory_callback,
643 NODE_CALLBACK_PRI); 649 NODE_CALLBACK_PRI);
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 935699b30b7c..1ac7f6e405f9 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -15,7 +15,6 @@
15#ifndef _LINUX_MEMORY_H_ 15#ifndef _LINUX_MEMORY_H_
16#define _LINUX_MEMORY_H_ 16#define _LINUX_MEMORY_H_
17 17
18#include <linux/sysdev.h>
19#include <linux/node.h> 18#include <linux/node.h>
20#include <linux/compiler.h> 19#include <linux/compiler.h>
21#include <linux/mutex.h> 20#include <linux/mutex.h>
@@ -38,7 +37,7 @@ struct memory_block {
38 int phys_device; /* to which fru does this belong? */ 37 int phys_device; /* to which fru does this belong? */
39 void *hw; /* optional pointer to fw/hw data */ 38 void *hw; /* optional pointer to fw/hw data */
40 int (*phys_callback)(struct memory_block *); 39 int (*phys_callback)(struct memory_block *);
41 struct sys_device sysdev; 40 struct device dev;
42}; 41};
43 42
44int arch_get_memory_phys_device(unsigned long start_pfn); 43int arch_get_memory_phys_device(unsigned long start_pfn);
diff --git a/include/linux/node.h b/include/linux/node.h
index 92370e22343c..624e53cecc02 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -14,12 +14,12 @@
14#ifndef _LINUX_NODE_H_ 14#ifndef _LINUX_NODE_H_
15#define _LINUX_NODE_H_ 15#define _LINUX_NODE_H_
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/cpumask.h> 18#include <linux/cpumask.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20 20
21struct node { 21struct node {
22 struct sys_device sysdev; 22 struct device dev;
23 23
24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) 24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
25 struct work_struct node_work; 25 struct work_struct node_work;
@@ -80,6 +80,6 @@ static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
80} 80}
81#endif 81#endif
82 82
83#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 83#define to_node(device) container_of(device, struct node, dev)
84 84
85#endif /* _LINUX_NODE_H_ */ 85#endif /* _LINUX_NODE_H_ */
diff --git a/mm/compaction.c b/mm/compaction.c
index 899d95638586..1253d7ac332b 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -721,23 +721,23 @@ int sysctl_extfrag_handler(struct ctl_table *table, int write,
721} 721}
722 722
723#if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA) 723#if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
724ssize_t sysfs_compact_node(struct sys_device *dev, 724ssize_t sysfs_compact_node(struct device *dev,
725 struct sysdev_attribute *attr, 725 struct device_attribute *attr,
726 const char *buf, size_t count) 726 const char *buf, size_t count)
727{ 727{
728 compact_node(dev->id); 728 compact_node(dev->id);
729 729
730 return count; 730 return count;
731} 731}
732static SYSDEV_ATTR(compact, S_IWUSR, NULL, sysfs_compact_node); 732static DEVICE_ATTR(compact, S_IWUSR, NULL, sysfs_compact_node);
733 733
734int compaction_register_node(struct node *node) 734int compaction_register_node(struct node *node)
735{ 735{
736 return sysdev_create_file(&node->sysdev, &attr_compact); 736 return device_create_file(&node->dev, &dev_attr_compact);
737} 737}
738 738
739void compaction_unregister_node(struct node *node) 739void compaction_unregister_node(struct node *node)
740{ 740{
741 return sysdev_remove_file(&node->sysdev, &attr_compact); 741 return device_remove_file(&node->dev, &dev_attr_compact);
742} 742}
743#endif /* CONFIG_SYSFS && CONFIG_NUMA */ 743#endif /* CONFIG_SYSFS && CONFIG_NUMA */
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index dae27ba3be2c..ad713e2d61bc 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1591,9 +1591,9 @@ static void __init hugetlb_sysfs_init(void)
1591 1591
1592/* 1592/*
1593 * node_hstate/s - associate per node hstate attributes, via their kobjects, 1593 * node_hstate/s - associate per node hstate attributes, via their kobjects,
1594 * with node sysdevs in node_devices[] using a parallel array. The array 1594 * with node devices in node_devices[] using a parallel array. The array
1595 * index of a node sysdev or _hstate == node id. 1595 * index of a node device or _hstate == node id.
1596 * This is here to avoid any static dependency of the node sysdev driver, in 1596 * This is here to avoid any static dependency of the node device driver, in
1597 * the base kernel, on the hugetlb module. 1597 * the base kernel, on the hugetlb module.
1598 */ 1598 */
1599struct node_hstate { 1599struct node_hstate {
@@ -1603,7 +1603,7 @@ struct node_hstate {
1603struct node_hstate node_hstates[MAX_NUMNODES]; 1603struct node_hstate node_hstates[MAX_NUMNODES];
1604 1604
1605/* 1605/*
1606 * A subset of global hstate attributes for node sysdevs 1606 * A subset of global hstate attributes for node devices
1607 */ 1607 */
1608static struct attribute *per_node_hstate_attrs[] = { 1608static struct attribute *per_node_hstate_attrs[] = {
1609 &nr_hugepages_attr.attr, 1609 &nr_hugepages_attr.attr,
@@ -1617,7 +1617,7 @@ static struct attribute_group per_node_hstate_attr_group = {
1617}; 1617};
1618 1618
1619/* 1619/*
1620 * kobj_to_node_hstate - lookup global hstate for node sysdev hstate attr kobj. 1620 * kobj_to_node_hstate - lookup global hstate for node device hstate attr kobj.
1621 * Returns node id via non-NULL nidp. 1621 * Returns node id via non-NULL nidp.
1622 */ 1622 */
1623static struct hstate *kobj_to_node_hstate(struct kobject *kobj, int *nidp) 1623static struct hstate *kobj_to_node_hstate(struct kobject *kobj, int *nidp)
@@ -1640,13 +1640,13 @@ static struct hstate *kobj_to_node_hstate(struct kobject *kobj, int *nidp)
1640} 1640}
1641 1641
1642/* 1642/*
1643 * Unregister hstate attributes from a single node sysdev. 1643 * Unregister hstate attributes from a single node device.
1644 * No-op if no hstate attributes attached. 1644 * No-op if no hstate attributes attached.
1645 */ 1645 */
1646void hugetlb_unregister_node(struct node *node) 1646void hugetlb_unregister_node(struct node *node)
1647{ 1647{
1648 struct hstate *h; 1648 struct hstate *h;
1649 struct node_hstate *nhs = &node_hstates[node->sysdev.id]; 1649 struct node_hstate *nhs = &node_hstates[node->dev.id];
1650 1650
1651 if (!nhs->hugepages_kobj) 1651 if (!nhs->hugepages_kobj)
1652 return; /* no hstate attributes */ 1652 return; /* no hstate attributes */
@@ -1662,7 +1662,7 @@ void hugetlb_unregister_node(struct node *node)
1662} 1662}
1663 1663
1664/* 1664/*
1665 * hugetlb module exit: unregister hstate attributes from node sysdevs 1665 * hugetlb module exit: unregister hstate attributes from node devices
1666 * that have them. 1666 * that have them.
1667 */ 1667 */
1668static void hugetlb_unregister_all_nodes(void) 1668static void hugetlb_unregister_all_nodes(void)
@@ -1670,7 +1670,7 @@ static void hugetlb_unregister_all_nodes(void)
1670 int nid; 1670 int nid;
1671 1671
1672 /* 1672 /*
1673 * disable node sysdev registrations. 1673 * disable node device registrations.
1674 */ 1674 */
1675 register_hugetlbfs_with_node(NULL, NULL); 1675 register_hugetlbfs_with_node(NULL, NULL);
1676 1676
@@ -1682,20 +1682,20 @@ static void hugetlb_unregister_all_nodes(void)
1682} 1682}
1683 1683
1684/* 1684/*
1685 * Register hstate attributes for a single node sysdev. 1685 * Register hstate attributes for a single node device.
1686 * No-op if attributes already registered. 1686 * No-op if attributes already registered.
1687 */ 1687 */
1688void hugetlb_register_node(struct node *node) 1688void hugetlb_register_node(struct node *node)
1689{ 1689{
1690 struct hstate *h; 1690 struct hstate *h;
1691 struct node_hstate *nhs = &node_hstates[node->sysdev.id]; 1691 struct node_hstate *nhs = &node_hstates[node->dev.id];
1692 int err; 1692 int err;
1693 1693
1694 if (nhs->hugepages_kobj) 1694 if (nhs->hugepages_kobj)
1695 return; /* already allocated */ 1695 return; /* already allocated */
1696 1696
1697 nhs->hugepages_kobj = kobject_create_and_add("hugepages", 1697 nhs->hugepages_kobj = kobject_create_and_add("hugepages",
1698 &node->sysdev.kobj); 1698 &node->dev.kobj);
1699 if (!nhs->hugepages_kobj) 1699 if (!nhs->hugepages_kobj)
1700 return; 1700 return;
1701 1701
@@ -1706,7 +1706,7 @@ void hugetlb_register_node(struct node *node)
1706 if (err) { 1706 if (err) {
1707 printk(KERN_ERR "Hugetlb: Unable to add hstate %s" 1707 printk(KERN_ERR "Hugetlb: Unable to add hstate %s"
1708 " for node %d\n", 1708 " for node %d\n",
1709 h->name, node->sysdev.id); 1709 h->name, node->dev.id);
1710 hugetlb_unregister_node(node); 1710 hugetlb_unregister_node(node);
1711 break; 1711 break;
1712 } 1712 }
@@ -1715,8 +1715,8 @@ void hugetlb_register_node(struct node *node)
1715 1715
1716/* 1716/*
1717 * hugetlb init time: register hstate attributes for all registered node 1717 * hugetlb init time: register hstate attributes for all registered node
1718 * sysdevs of nodes that have memory. All on-line nodes should have 1718 * devices of nodes that have memory. All on-line nodes should have
1719 * registered their associated sysdev by this time. 1719 * registered their associated device by this time.
1720 */ 1720 */
1721static void hugetlb_register_all_nodes(void) 1721static void hugetlb_register_all_nodes(void)
1722{ 1722{
@@ -1724,12 +1724,12 @@ static void hugetlb_register_all_nodes(void)
1724 1724
1725 for_each_node_state(nid, N_HIGH_MEMORY) { 1725 for_each_node_state(nid, N_HIGH_MEMORY) {
1726 struct node *node = &node_devices[nid]; 1726 struct node *node = &node_devices[nid];
1727 if (node->sysdev.id == nid) 1727 if (node->dev.id == nid)
1728 hugetlb_register_node(node); 1728 hugetlb_register_node(node);
1729 } 1729 }
1730 1730
1731 /* 1731 /*
1732 * Let the node sysdev driver know we're here so it can 1732 * Let the node device driver know we're here so it can
1733 * [un]register hstate attributes on node hotplug. 1733 * [un]register hstate attributes on node hotplug.
1734 */ 1734 */
1735 register_hugetlbfs_with_node(hugetlb_register_node, 1735 register_hugetlbfs_with_node(hugetlb_register_node,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index a1893c050795..2b4189d759e4 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3475,16 +3475,16 @@ int scan_unevictable_handler(struct ctl_table *table, int write,
3475 * a specified node's per zone unevictable lists for evictable pages. 3475 * a specified node's per zone unevictable lists for evictable pages.
3476 */ 3476 */
3477 3477
3478static ssize_t read_scan_unevictable_node(struct sys_device *dev, 3478static ssize_t read_scan_unevictable_node(struct device *dev,
3479 struct sysdev_attribute *attr, 3479 struct device_attribute *attr,
3480 char *buf) 3480 char *buf)
3481{ 3481{
3482 warn_scan_unevictable_pages(); 3482 warn_scan_unevictable_pages();
3483 return sprintf(buf, "0\n"); /* always zero; should fit... */ 3483 return sprintf(buf, "0\n"); /* always zero; should fit... */
3484} 3484}
3485 3485
3486static ssize_t write_scan_unevictable_node(struct sys_device *dev, 3486static ssize_t write_scan_unevictable_node(struct device *dev,
3487 struct sysdev_attribute *attr, 3487 struct device_attribute *attr,
3488 const char *buf, size_t count) 3488 const char *buf, size_t count)
3489{ 3489{
3490 warn_scan_unevictable_pages(); 3490 warn_scan_unevictable_pages();
@@ -3492,17 +3492,17 @@ static ssize_t write_scan_unevictable_node(struct sys_device *dev,
3492} 3492}
3493 3493
3494 3494
3495static SYSDEV_ATTR(scan_unevictable_pages, S_IRUGO | S_IWUSR, 3495static DEVICE_ATTR(scan_unevictable_pages, S_IRUGO | S_IWUSR,
3496 read_scan_unevictable_node, 3496 read_scan_unevictable_node,
3497 write_scan_unevictable_node); 3497 write_scan_unevictable_node);
3498 3498
3499int scan_unevictable_register_node(struct node *node) 3499int scan_unevictable_register_node(struct node *node)
3500{ 3500{
3501 return sysdev_create_file(&node->sysdev, &attr_scan_unevictable_pages); 3501 return device_create_file(&node->dev, &dev_attr_scan_unevictable_pages);
3502} 3502}
3503 3503
3504void scan_unevictable_unregister_node(struct node *node) 3504void scan_unevictable_unregister_node(struct node *node)
3505{ 3505{
3506 sysdev_remove_file(&node->sysdev, &attr_scan_unevictable_pages); 3506 device_remove_file(&node->dev, &dev_attr_scan_unevictable_pages);
3507} 3507}
3508#endif 3508#endif