Skip to contentSkip to conversation

Container.ko: Use kobject_hotplug() to notify user agent

PATCH Applied Keshavamurthy Anil S 2 participants 2 messages Nov 11, 2004 1 message not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Container.ko: Use kobject_hotplug() to notify user agent

Hi Len,
Due to "hotplug_path" getting un-exported from mm3, the container code
was breaking and was asked to use kobject_hotplug to notify user agent.

So I have fixed the container driver to use kobject_hotplug(). This patch will fix the undefined "hotplug_path" warning.

Please apply.

---

 linux-2.6.10-rc1-mm4-askeshav/drivers/acpi/container.c |   52 -----------------
 1 files changed, 3 insertions(+), 49 deletions(-)
drivers/acpi/container.c renamed from drivers/acpi/container.c~container_u1_hotplug_path_fix +3 -49
diff -puN drivers/acpi/container.c~container_u1_hotplug_path_fix drivers/acpi/container.c
@@ -133,52 +133,6 @@ acpi_container_remove(struct acpi_device
 
 
 static int
-container_run_sbin_hotplug(struct acpi_device *device, char *action)
-{
-	char *argv[3], *envp[6], action_str[32];
-	int i, ret;
-	int len;
-	char pathname[ACPI_PATHNAME_MAX] = {0};
-	acpi_status status;
-	char *container_str;
-	struct acpi_buffer buffer = {ACPI_PATHNAME_MAX, pathname};
-
-	ACPI_FUNCTION_TRACE("container_run_sbin_hotplug");
-
-
-	status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
-	if (ACPI_FAILURE(status)) {
-		return(-ENODEV);
-	}
-
-	len = strlen("CONTAINER=") + strlen(pathname) + 1;
-	container_str = kmalloc(len, GFP_KERNEL);
-	if (!container_str)
-		return(-ENOMEM);
-
-	sprintf(container_str, "CONTAINER=%s",pathname);
-	sprintf(action_str, "ACTION=%s", action);
-
-	i = 0;
-	argv[i++] = hotplug_path;
-	argv[i++] = "container";
-	argv[i] = NULL;
-
-	i = 0;
-	envp[i++] = "HOME=/";
-	envp[i++] = "PATH=/sbin;/bin;/usr/sbin;/usr/bin";
-	envp[i++] = action_str;
-	envp[i++] = container_str;
-	envp[i++] = "PLATFORM=ACPI";
-	envp[i] = NULL;
-
-	ret = call_usermodehelper(argv[0], argv, envp, 0);
-
-	kfree(container_str);
-	return_VALUE(ret);
-}
-
-static int
 container_device_add(struct acpi_device **device, acpi_handle handle)
 {
 	acpi_handle phandle;
@@ -228,16 +182,16 @@ container_notify_cb(acpi_handle handle, 
 			if (ACPI_FAILURE(status) || !device) {
 				result = container_device_add(&device, handle);
 				if (!result)
-					container_run_sbin_hotplug(device, "add");
+					kobject_hotplug(&device->kobj, KOBJ_ONLINE);
 			} else {
 				/* device exist and this is a remove request */
-				container_run_sbin_hotplug(device, "remove");
+				kobject_hotplug(&device->kobj, KOBJ_OFFLINE);
 			}
 		}
 		break;
 	case ACPI_NOTIFY_EJECT_REQUEST:
 		if (!acpi_bus_get_device(handle, &device) && device) {
-			container_run_sbin_hotplug(device, "remove");
+			kobject_hotplug(&device->kobj, KOBJ_OFFLINE);
 		}
 		break;
 	default:

_

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

A message that is not in the archive (sent off-list or not yet received): 20041110181653.A15383-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org

Applied
#2 lore raw

Applied,

thanks,
-Len

Quoted 64 lines · Keshavamurthy Anil S

Hi Len,
Due to "hotplug_path" getting un-exported from mm3, the
container code
was breaking and was asked to use kobject_hotplug to notify user agent.

So I have fixed the container driver to use kobject_hotplug(). This patch will fix the undefined "hotplug_path" warning.

Please apply.

---

 linux-2.6.10-rc1-mm4-askeshav/drivers/acpi/container.c |   52
-----------------
 1 files changed, 3 insertions(+), 49 deletions(-)

diff -puN drivers/acpi/container.c~container_u1_hotplug_path_fix
drivers/acpi/container.c
---
linux-2.6.10-rc1-mm4/drivers/acpi/container.c~container_u1_hotplug_path_fix 2004-11-10 13:33:29.657947459 -0800 +++ linux-2.6.10-rc1-mm4-askeshav/drivers/acpi/container.c

2004-11-10 13:33:29.735095896 -0800
drivers/acpi/container.c renamed from drivers/acpi/container.c~container_u1_hotplug_path_fix +0 -36
@@ -133,52 +133,6 @@ acpi_container_remove(struct acpi_device
 
 
 static int
-container_run_sbin_hotplug(struct acpi_device *device, char *action)
-{
-       char *argv[3], *envp[6], action_str[32];
-       int i, ret;
-       int len;
-       char pathname[ACPI_PATHNAME_MAX] = {0};
-       acpi_status status;
-       char *container_str;
-       struct acpi_buffer buffer = {ACPI_PATHNAME_MAX, pathname};
-
-       ACPI_FUNCTION_TRACE("container_run_sbin_hotplug");
-
-
-       status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME,
 &buffer);
-       if (ACPI_FAILURE(status)) {
-               return(-ENODEV);
-       }
-
-       len = strlen("CONTAINER=") + strlen(pathname) + 1;
-       container_str = kmalloc(len, GFP_KERNEL);
-       if (!container_str)
-               return(-ENOMEM);
-
-       sprintf(container_str, "CONTAINER=%s",pathname);
-       sprintf(action_str, "ACTION=%s", action);
-
-       i = 0;
-       argv[i++] = hotplug_path;
-       argv[i++] = "container";
-       argv[i] = NULL;
-
-       i = 0;
-       envp[i++] = "HOME=/";
-       envp[i++] = "PATH=/sbin;/bin;/usr/sbin;/usr/bin";
-       envp[i++] = action_str;
-       envp[i++] = container_str;

drivers/acpi/container.c acpi_container_remove(struct acpi_device · line 182

Quoted 10 lines
drivers/acpi/container.c renamed from drivers/acpi/container.c~container_u1_hotplug_path_fix +0 -10
-       envp[i++] = "PLATFORM=ACPI";
-       envp[i] = NULL;
-
-       ret = call_usermodehelper(argv[0], argv, envp, 0);
-
-       kfree(container_str);
-       return_VALUE(ret);
-}
-
-static int

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click