aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
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/hugetlb.c
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/hugetlb.c')
-rw-r--r--mm/hugetlb.c34
1 files changed, 17 insertions, 17 deletions
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,