summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-08-12 20:43:55 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 14:51:06 -0700
commit5c5daf657cb5f963a38413f2852279d7a3843144 (patch)
treeec314c25ca40528bd4625944a93846d1654c9cd9 /drivers/base
parent07c015e7654821f2dda00dcf152c65b2afd46ac3 (diff)
downloadop-kernel-dev-5c5daf657cb5f963a38413f2852279d7a3843144.zip
op-kernel-dev-5c5daf657cb5f963a38413f2852279d7a3843144.tar.gz
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')
-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 d487c03..65de221 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,
/* search the kset, the device belongs to */
top_kobj = &dev->kobj;
- if (!top_kobj->kset && top_kobj->parent) {
- do {
- top_kobj = top_kobj->parent;
- } while (!top_kobj->kset && top_kobj->parent);
- }
+ while (!top_kobj->kset && top_kobj->parent)
+ top_kobj = top_kobj->parent;
if (!top_kobj->kset)
goto out;
+
kset = top_kobj->kset;
if (!kset->uevent_ops || !kset->uevent_ops->uevent)
goto out;
@@ -270,17 +268,9 @@ out:
static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- size_t len = count;
enum kobject_action action;
- if (len && buf[len-1] == '\n')
- len--;
-
- for (action = 0; action < KOBJ_MAX; action++) {
- if (strncmp(kobject_actions[action], buf, len) != 0)
- continue;
- if (kobject_actions[action][len] != '\0')
- continue;
+ if (kobject_action_type(buf, count, &action) == 0) {
kobject_uevent(&dev->kobj, action);
goto out;
}
OpenPOWER on IntegriCloud