aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index d487c032dc4a..65de221e3bfa 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -234,13 +234,11 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
234 234
235 /* search the kset, the device belongs to */ 235 /* search the kset, the device belongs to */
236 top_kobj = &dev->kobj; 236 top_kobj = &dev->kobj;
237 if (!top_kobj->kset && top_kobj->parent) { 237 while (!top_kobj->kset && top_kobj->parent)
238 do { 238 top_kobj = top_kobj->parent;
239 top_kobj = top_kobj->parent;
240 } while (!top_kobj->kset && top_kobj->parent);
241 }
242 if (!top_kobj->kset) 239 if (!top_kobj->kset)
243 goto out; 240 goto out;
241
244 kset = top_kobj->kset; 242 kset = top_kobj->kset;
245 if (!kset->uevent_ops || !kset->uevent_ops->uevent) 243 if (!kset->uevent_ops || !kset->uevent_ops->uevent)
246 goto out; 244 goto out;
@@ -270,17 +268,9 @@ out:
270static ssize_t store_uevent(struct device *dev, struct device_attribute *attr, 268static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,
271 const char *buf, size_t count) 269 const char *buf, size_t count)
272{ 270{
273 size_t len = count;
274 enum kobject_action action; 271 enum kobject_action action;
275 272
276 if (len && buf[len-1] == '\n') 273 if (kobject_action_type(buf, count, &action) == 0) {
277 len--;
278
279 for (action = 0; action < KOBJ_MAX; action++) {
280 if (strncmp(kobject_actions[action], buf, len) != 0)
281 continue;
282 if (kobject_actions[action][len] != '\0')
283 continue;
284 kobject_uevent(&dev->kobj, action); 274 kobject_uevent(&dev->kobj, action);
285 goto out; 275 goto out;
286 } 276 }