diff options
Diffstat (limited to 'lib/kobject_uevent.c')
-rw-r--r-- | lib/kobject_uevent.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 82fc1794b691..12e311dc664c 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -42,10 +42,6 @@ static char *action_to_string(enum kobject_action action) | |||
42 | return "remove"; | 42 | return "remove"; |
43 | case KOBJ_CHANGE: | 43 | case KOBJ_CHANGE: |
44 | return "change"; | 44 | return "change"; |
45 | case KOBJ_MOUNT: | ||
46 | return "mount"; | ||
47 | case KOBJ_UMOUNT: | ||
48 | return "umount"; | ||
49 | case KOBJ_OFFLINE: | 45 | case KOBJ_OFFLINE: |
50 | return "offline"; | 46 | return "offline"; |
51 | case KOBJ_ONLINE: | 47 | case KOBJ_ONLINE: |
@@ -95,10 +91,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
95 | 91 | ||
96 | /* search the kset we belong to */ | 92 | /* search the kset we belong to */ |
97 | top_kobj = kobj; | 93 | top_kobj = kobj; |
98 | if (!top_kobj->kset && top_kobj->parent) { | 94 | while (!top_kobj->kset && top_kobj->parent) { |
99 | do { | 95 | top_kobj = top_kobj->parent; |
100 | top_kobj = top_kobj->parent; | ||
101 | } while (!top_kobj->kset && top_kobj->parent); | ||
102 | } | 96 | } |
103 | if (!top_kobj->kset) { | 97 | if (!top_kobj->kset) { |
104 | pr_debug("kobject attempted to send uevent without kset!\n"); | 98 | pr_debug("kobject attempted to send uevent without kset!\n"); |
@@ -115,6 +109,16 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
115 | return 0; | 109 | return 0; |
116 | } | 110 | } |
117 | 111 | ||
112 | /* originating subsystem */ | ||
113 | if (uevent_ops && uevent_ops->name) | ||
114 | subsystem = uevent_ops->name(kset, kobj); | ||
115 | else | ||
116 | subsystem = kobject_name(&kset->kobj); | ||
117 | if (!subsystem) { | ||
118 | pr_debug("unset subsytem caused the event to drop!\n"); | ||
119 | return 0; | ||
120 | } | ||
121 | |||
118 | /* environment index */ | 122 | /* environment index */ |
119 | envp = kzalloc(NUM_ENVP * sizeof (char *), GFP_KERNEL); | 123 | envp = kzalloc(NUM_ENVP * sizeof (char *), GFP_KERNEL); |
120 | if (!envp) | 124 | if (!envp) |
@@ -134,12 +138,6 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
134 | goto exit; | 138 | goto exit; |
135 | } | 139 | } |
136 | 140 | ||
137 | /* originating subsystem */ | ||
138 | if (uevent_ops && uevent_ops->name) | ||
139 | subsystem = uevent_ops->name(kset, kobj); | ||
140 | else | ||
141 | subsystem = kobject_name(&kset->kobj); | ||
142 | |||
143 | /* event environemnt for helper process only */ | 141 | /* event environemnt for helper process only */ |
144 | envp[i++] = "HOME=/"; | 142 | envp[i++] = "HOME=/"; |
145 | envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; | 143 | envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; |