aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-12-21 17:48:43 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-21 17:48:43 -0500
commit10fbcf4c6cb122005cdf36fc24d7683da92c7a27 (patch)
tree1a2ad572b421d576e14dbf006ecb321a53063f0c /mm
parent8a25a2fd126c621f44f3aeaef80d51f00fc11639 (diff)
convert 'memory' sysdev_class to a regular subsystem
This moves the 'memory sysdev_class' over to a regular 'memory' subsystem and converts the devices to regular devices. The sysdev drivers are implemented as subsystem interfaces now. After all sysdev classes are ported to regular driver core entities, the sysdev implementation will be entirely removed from the kernel. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'mm')
-rw-r--r--mm/compaction.c10
-rw-r--r--mm/hugetlb.c34
-rw-r--r--mm/vmscan.c14
3 files changed, 29 insertions, 29 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 899d9563858..1253d7ac332 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 dae27ba3be2..ad713e2d61b 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 a1893c05079..2b4189d759e 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