linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH] unregister_node() for hotplug use
@ 2005-04-20 12:07 Keiichiro Tokunaga
  2005-04-20 12:35 ` Arjan van de Ven
  2005-04-20 17:32 ` Greg KH
  0 siblings, 2 replies; 20+ messages in thread
From: Keiichiro Tokunaga @ 2005-04-20 12:07 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: Keiichiro Tokunaga

  This is to add a generic function 'unregister_node()'.
It is used to remove objects of a node going away for
hotplug.  If CONFIG_HOTPLUG=y, it becomes available.
This is against 2.6.12-rc2-mm3.

Thanks,
Keiichiro Tokunaga

Signed-off-by: Keiichiro Tokunaga <tokunaga.keiich@jp.fujitsu.com>
---

 linux-2.6.12-rc2-mm3-kei/drivers/base/node.c  |   29 ++++++++++++++++++++++++--
 linux-2.6.12-rc2-mm3-kei/include/linux/node.h |    6 ++++-
 2 files changed, 32 insertions(+), 3 deletions(-)

diff -puN drivers/base/node.c~numa_hp_base drivers/base/node.c
--- linux-2.6.12-rc2-mm3/drivers/base/node.c~numa_hp_base	2005-04-14 20:49:37.000000000 +0900
+++ linux-2.6.12-rc2-mm3-kei/drivers/base/node.c	2005-04-14 20:49:37.000000000 +0900
@@ -136,7 +136,7 @@ static SYSDEV_ATTR(distance, S_IRUGO, no
  *
  * Initialize and register the node device.
  */
-int __init register_node(struct node *node, int num, struct node *parent)
+int __devinit register_node(struct node *node, int num, struct node *parent)
 {
 	int error;
 
@@ -145,6 +145,9 @@ int __init register_node(struct node *no
 	error = sysdev_register(&node->sysdev);
 
 	if (!error){
+		/*
+		 * If you add new object here, delete it when unregistering.
+		 */
 		sysdev_create_file(&node->sysdev, &attr_cpumap);
 		sysdev_create_file(&node->sysdev, &attr_meminfo);
 		sysdev_create_file(&node->sysdev, &attr_numastat);
@@ -153,8 +156,30 @@ int __init register_node(struct node *no
 	return error;
 }
 
+/*
+ * unregister_node - Remove objects of a node going away from sysfs.
+ * @node - node going away
+ *
+ * This is used only for hotplug.
+ */
+#ifdef CONFIG_HOTPLUG
+void unregister_node(struct node *node)
+{
+	if (node == NULL)
+		return;
+
+	sysdev_remove_file(&node->sysdev, &attr_cpumap);
+	sysdev_remove_file(&node->sysdev, &attr_meminfo);
+	sysdev_remove_file(&node->sysdev, &attr_numastat);
+	sysdev_remove_file(&node->sysdev, &attr_distance);
+
+	sysdev_unregister(&node->sysdev);
+}
+EXPORT_SYMBOL(register_node);
+EXPORT_SYMBOL(unregister_node);
+#endif /* CONFIG_HOTPLUG */
 
-int __init register_node_type(void)
+static int __init register_node_type(void)
 {
 	return sysdev_class_register(&node_class);
 }
diff -puN include/linux/node.h~numa_hp_base include/linux/node.h
--- linux-2.6.12-rc2-mm3/include/linux/node.h~numa_hp_base	2005-04-14 20:49:37.000000000 +0900
+++ linux-2.6.12-rc2-mm3-kei/include/linux/node.h	2005-04-14 20:49:37.000000000 +0900
@@ -21,12 +21,16 @@
 
 #include <linux/sysdev.h>
 #include <linux/cpumask.h>
+#include <linux/module.h>
 
 struct node {
 	struct sys_device	sysdev;
 };
 
-extern int register_node(struct node *, int, struct node *);
+extern int __devinit register_node(struct node *, int, struct node *);
+#ifdef CONFIG_HOTPLUG
+extern void unregister_node(struct node *node);
+#endif
 
 #define to_node(sys_device) container_of(sys_device, struct node, sysdev)
 

_

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2005-05-10 20:15 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-20 12:07 [RFC/PATCH] unregister_node() for hotplug use Keiichiro Tokunaga
2005-04-20 12:35 ` Arjan van de Ven
2005-04-21  9:25   ` Keiichiro Tokunaga
2005-04-20 17:32 ` Greg KH
2005-04-21 15:30   ` Keiichiro Tokunaga
2005-04-22  0:39     ` Greg KH
2005-04-22  2:32       ` Keiichiro Tokunaga
2005-04-25 14:03         ` Keiichiro Tokunaga
2005-04-26  6:54           ` Greg KH
2005-04-28  0:17             ` Keiichiro Tokunaga
2005-05-07 12:11             ` Keiichiro Tokunaga
2005-05-08  0:26               ` Nathan Lynch
2005-05-08 12:28                 ` Keiichiro Tokunaga
2005-05-09 22:44               ` Matthew Dobson
2005-05-10 11:20                 ` Keiichiro Tokunaga
2005-05-10 18:15                   ` Matthew Dobson
2005-05-10 18:45                     ` Greg KH
2005-05-10 18:58                       ` Matthew Dobson
2005-05-10 20:11                         ` Greg KH
2005-05-10 20:13                           ` Matthew Dobson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).