
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           |    2 +
 4 files changed, 5 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-21 14:55:12.702870976 -0700
+++ 25-akpm/drivers/base/cpu.c	2004-10-21 14:55:12.709869912 -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-21 14:55:12.703870824 -0700
+++ 25-akpm/include/linux/kobject_uevent.h	2004-10-21 14:55:12.709869912 -0700
@@ -22,6 +22,7 @@ enum kobject_action {
 	KOBJ_CHANGE	= (__force kobject_action_t) 0x03,	/* a sysfs attribute file has changed */
 	KOBJ_MOUNT	= (__force kobject_action_t) 0x04,	/* mount event for block devices */
 	KOBJ_UMOUNT	= (__force kobject_action_t) 0x05,	/* umount event for block devices */
+	KOBJ_OFFLINE	= (__force kobject_action_t) 0x06,	/* offline event for hotplug devices */
 };
 
 
diff -puN kernel/cpu.c~remove-cpu_run_sbin_hotplug kernel/cpu.c
--- 25/kernel/cpu.c~remove-cpu_run_sbin_hotplug	2004-10-21 14:55:12.704870672 -0700
+++ 25-akpm/kernel/cpu.c	2004-10-21 14:55:12.710869760 -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)
 {
@@ -167,8 +139,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:
@@ -177,11 +147,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-21 14:55:12.706870368 -0700
+++ 25-akpm/lib/kobject_uevent.c	2004-10-21 14:55:12.710869760 -0700
@@ -37,6 +37,8 @@ static char *action_to_string(enum kobje
 		return "mount";
 	case KOBJ_UMOUNT:
 		return "umount";
+	case KOBJ_OFFLINE:
+		return "offline";
 	default:
 		return NULL;
 	}
_
