aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/node.c20
-rw-r--r--include/linux/node.h1
2 files changed, 19 insertions, 2 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 583d57ec49a8..5d4517ccc422 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -136,7 +136,7 @@ static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL);
136 * 136 *
137 * Initialize and register the node device. 137 * Initialize and register the node device.
138 */ 138 */
139int __init register_node(struct node *node, int num, struct node *parent) 139int register_node(struct node *node, int num, struct node *parent)
140{ 140{
141 int error; 141 int error;
142 142
@@ -153,8 +153,24 @@ int __init register_node(struct node *node, int num, struct node *parent)
153 return error; 153 return error;
154} 154}
155 155
156/**
157 * unregister_node - unregister a node device
158 * @node: node going away
159 *
160 * Unregisters a node device @node. All the devices on the node must be
161 * unregistered before calling this function.
162 */
163void unregister_node(struct node *node)
164{
165 sysdev_remove_file(&node->sysdev, &attr_cpumap);
166 sysdev_remove_file(&node->sysdev, &attr_meminfo);
167 sysdev_remove_file(&node->sysdev, &attr_numastat);
168 sysdev_remove_file(&node->sysdev, &attr_distance);
169
170 sysdev_unregister(&node->sysdev);
171}
156 172
157int __init register_node_type(void) 173static int __init register_node_type(void)
158{ 174{
159 return sysdev_class_register(&node_class); 175 return sysdev_class_register(&node_class);
160} 176}
diff --git a/include/linux/node.h b/include/linux/node.h
index 6e0a697e594e..254dc3de650b 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -27,6 +27,7 @@ struct node {
27}; 27};
28 28
29extern int register_node(struct node *, int, struct node *); 29extern int register_node(struct node *, int, struct node *);
30extern void unregister_node(struct node *node);
30 31
31#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 32#define to_node(sys_device) container_of(sys_device, struct node, sysdev)
32 33