ChangeSet 1.1938.505.18, 2005/03/02 14:02:55-05:00, [EMAIL PROTECTED]

        [ACPI] fix kobject_hotplug() use by ACPI processor and container drivers
        
        A while ago, the drivers used their own function
        'processor_run_sbin_hotplug() and container_run_sbin_hotplug()' to 
notify
        the agent script using /sbin/hotplug mechanism.  But, they were changed 
to
        use kobject_hotplug() instead and this has caused a side effect.
        
        The container driver was supposed to invoke a container.agent (user mode
        agent script) using /sbin/hotplug mechanism, but after the changes, it 
is
        not able to call the agent any more and kobject_hotplug() in the
        container.c became to invoke a namespace.agent instead if exists.  So, I
        would like to use the namespace.agent to handle container hotplug event 
(or
        something else) and let the agent to call proper agent (e.g. 
        container.agent).  But, there is an issue we need to solve.  When the
        namespace.agent is called, a path name of associated kobject is passed 
as a
        DEVPATH (e.g./sys/firmware/ acpi/namespace/ACPI/_SB/DEV0).  However, the
        agent would not know what device is associated with the DEVPATH nor 
which
        agents to call since the DEVPATH name depends on platform.  The attached
        patch is to add .hotplug_ops member to acpi_namespace_kset structure and
        let it to set a driver name attached to the target kobject into the 
envp[]
        variable as a DRV_NAME element.  With this, the namespace.agent can call
        proper agents (e.g.  container.agent) by refering the DRV_NAME.
        
        Signed-off-by: Keiichiro Tokunaga <[EMAIL PROTECTED]>
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: Len Brown <[EMAIL PROTECTED]>



 scan.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+)


diff -Nru a/drivers/acpi/scan.c b/drivers/acpi/scan.c
--- a/drivers/acpi/scan.c       2005-04-01 08:10:51 -08:00
+++ b/drivers/acpi/scan.c       2005-04-01 08:10:51 -08:00
@@ -81,12 +81,37 @@
        .release        = acpi_device_release,
 };
 
+static int namespace_hotplug(struct kset *kset, struct kobject *kobj,
+                            char **envp, int num_envp, char *buffer,
+                            int buffer_size)
+{
+       struct acpi_device *dev = to_acpi_device(kobj);
+       int i = 0;
+       int len = 0;
+
+       if (!dev->driver)
+               return 0;
+
+       if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len,
+                               "PHYSDEVDRIVER=%s", dev->driver->name))
+               return -ENOMEM;
+
+       envp[i] = NULL;
+
+       return 0;
+}
+
+static struct kset_hotplug_ops namespace_hotplug_ops = {
+       .hotplug = &namespace_hotplug,
+};
+
 static struct kset acpi_namespace_kset = {
        .kobj           = { 
                .name = "namespace",
        },
        .subsys = &acpi_subsys,
        .ktype  = &ktype_acpi_ns,
+       .hotplug_ops = &namespace_hotplug_ops,
 };
 
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to