
From: Keshavamurthy Anil S <anil.s.keshavamurthy@intel.com>

Remove cpu_run_sbin_hotplug() - use kobject_hotplug() instead.

Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/base/cpu.c             |    2 +
 25-akpm/include/linux/kobject_uevent.h |    1 
 25-akpm/kernel/cpu.c                   |   35 ---------------------------------
 25-akpm/lib/kobject_uevent.c           |    1 
 4 files changed, 4 insertions(+), 35 deletions(-)

diff -puN drivers/base/cpu.c~remove-cpu_run_sbin_hotplug drivers/base/cpu.c
--- 25/drivers/base/cpu.c~remove-cpu_run_sbin_hotplug	2004-10-06 20:53:17.135034504 -0700
+++ 25-akpm/drivers/base/cpu.c	2004-10-06 20:53:17.143033288 -0700
@@ -32,6 +32,8 @@ static ssize_t store_online(struct sys_d
 	switch (buf[0]) {
 	case '0':
 		ret = cpu_down(cpu->sysdev.id);
+		if (!ret)
+			kobject_hotplug(&dev->kobj, KOBJ_OFFLINE);
 		break;
 	case '1':
 		ret = cpu_up(cpu->sysdev.id);
diff -puN include/linux/kobject_uevent.h~remove-cpu_run_sbin_hotplug include/linux/kobject_uevent.h
--- 25/include/linux/kobject_uevent.h~remove-cpu_run_sbin_hotplug	2004-10-06 20:53:17.137034200 -0700
+++ 25-akpm/include/linux/kobject_uevent.h	2004-10-06 20:53:17.144033136 -0700
@@ -22,6 +22,7 @@ enum kobject_action {
 	KOBJ_CHANGE	= 0x02,	/* a sysfs attribute file has changed */
 	KOBJ_MOUNT	= 0x03,	/* mount event for block devices */
 	KOBJ_UMOUNT	= 0x04,	/* umount event for block devices */
+	KOBJ_OFFLINE	= 0x05,	/* offline event for hotplug devices */
 	KOBJ_MAX_ACTION,	/* must be last action listed */
 };
 
diff -puN kernel/cpu.c~remove-cpu_run_sbin_hotplug kernel/cpu.c
--- 25/kernel/cpu.c~remove-cpu_run_sbin_hotplug	2004-10-06 20:53:17.138034048 -0700
+++ 25-akpm/kernel/cpu.c	2004-10-06 20:53:17.144033136 -0700
@@ -57,34 +57,6 @@ static inline void check_for_tasks(int c
 	write_unlock_irq(&tasklist_lock);
 }
 
-/* Notify userspace when a cpu event occurs, by running '/sbin/hotplug
- * cpu' with certain environment variables set.  */
-static int cpu_run_sbin_hotplug(unsigned int cpu, const char *action)
-{
-	char *argv[3], *envp[6], cpu_str[12], action_str[32], devpath_str[40];
-	int i;
-
-	sprintf(cpu_str, "CPU=%d", cpu);
-	sprintf(action_str, "ACTION=%s", action);
-	sprintf(devpath_str, "DEVPATH=devices/system/cpu/cpu%d", cpu);
-	
-	i = 0;
-	argv[i++] = hotplug_path;
-	argv[i++] = "cpu";
-	argv[i] = NULL;
-
-	i = 0;
-	/* minimal command environment */
-	envp[i++] = "HOME=/";
-	envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
-	envp[i++] = cpu_str;
-	envp[i++] = action_str;
-	envp[i++] = devpath_str;
-	envp[i] = NULL;
-
-	return call_usermodehelper(argv[0], argv, envp, 0);
-}
-
 /* Take this CPU down. */
 static int take_cpu_down(void *unused)
 {
@@ -170,8 +142,6 @@ int cpu_down(unsigned int cpu)
 
 	check_for_tasks(cpu);
 
-	cpu_run_sbin_hotplug(cpu, "offline");
-
 out_thread:
 	err = kthread_stop(p);
 out_allowed:
@@ -180,11 +150,6 @@ out:
 	unlock_cpu_hotplug();
 	return err;
 }
-#else
-static inline int cpu_run_sbin_hotplug(unsigned int cpu, const char *action)
-{
-	return 0;
-}
 #endif /*CONFIG_HOTPLUG_CPU*/
 
 int __devinit cpu_up(unsigned int cpu)
diff -puN lib/kobject_uevent.c~remove-cpu_run_sbin_hotplug lib/kobject_uevent.c
--- 25/lib/kobject_uevent.c~remove-cpu_run_sbin_hotplug	2004-10-06 20:53:17.140033744 -0700
+++ 25-akpm/lib/kobject_uevent.c	2004-10-06 20:53:17.145032984 -0700
@@ -34,6 +34,7 @@ static char *actions[] = {
 	"change",	/* 0x02 */
 	"mount",	/* 0x03 */
 	"umount",	/* 0x04 */
+	"offline",	/* 0x05 */
 };
 
 static char *action_to_string(enum kobject_action action)
_
