aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-08-12 14:43:55 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:51:06 -0400
commit5c5daf657cb5f963a38413f2852279d7a3843144 (patch)
treeec314c25ca40528bd4625944a93846d1654c9cd9 /drivers/base/core.c
parent07c015e7654821f2dda00dcf152c65b2afd46ac3 (diff)
Driver core: exclude kobject_uevent.c for !CONFIG_HOTPLUG
Move uevent specific logic from the core into kobject_uevent.c, which does no longer require to link the unused string array if hotplug is not compiled in. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 }