drivers/net/appletalk/ltpc.c: replace init_module&cleanup_module with module_init...
[safe/jmp/linux-2.6] / lib / kobject_uevent.c
index 51dc4d2..5a402e2 100644 (file)
@@ -180,6 +180,17 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
                }
        }
 
+       /*
+        * Mark "add" and "remove" events in the object to ensure proper
+        * events to userspace during automatic cleanup. If the object did
+        * send an "add" event, "remove" will automatically generated by
+        * the core, if not already done by the caller.
+        */
+       if (action == KOBJ_ADD)
+               kobj->state_add_uevent_sent = 1;
+       else if (action == KOBJ_REMOVE)
+               kobj->state_remove_uevent_sent = 1;
+
        /* we will send an event, so request a new sequence number */
        spin_lock(&sequence_lock);
        seq = ++uevent_seqnum;
@@ -227,11 +238,12 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
                retval = add_uevent_var(env, "HOME=/");
                if (retval)
                        goto exit;
-               retval = add_uevent_var(env, "PATH=/sbin:/bin:/usr/sbin:/usr/bin");
+               retval = add_uevent_var(env,
+                                       "PATH=/sbin:/bin:/usr/sbin:/usr/bin");
                if (retval)
                        goto exit;
 
-               call_usermodehelper (argv[0], argv, env->envp, UMH_WAIT_EXEC);
+               call_usermodehelper(argv[0], argv, env->envp, UMH_WAIT_EXEC);
        }
 
 exit:
@@ -239,7 +251,6 @@ exit:
        kfree(env);
        return retval;
 }
-
 EXPORT_SYMBOL_GPL(kobject_uevent_env);
 
 /**
@@ -255,7 +266,6 @@ int kobject_uevent(struct kobject *kobj, enum kobject_action action)
 {
        return kobject_uevent_env(kobj, action, NULL);
 }
-
 EXPORT_SYMBOL_GPL(kobject_uevent);
 
 /**