diff options
| author | Ben Dooks <ben-linux@fluff.org> | 2008-08-08 21:10:12 +0100 |
|---|---|---|
| committer | Ben Dooks <ben-linux@fluff.org> | 2008-08-08 21:10:12 +0100 |
| commit | af7a535688a758d15f06a98833e6a143b29af9de (patch) | |
| tree | bac5ab210bbbbe276f0e44ed84194d7c8bb16aae /lib/kobject.c | |
| parent | 0c17e4ceedd35c78b1c7413dbd16279a350be6bc (diff) | |
| parent | c41107c2d4fd31924533f4dbc4c3428acc2b5894 (diff) | |
Merge http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm into for-rmk
Diffstat (limited to 'lib/kobject.c')
| -rw-r--r-- | lib/kobject.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 718e5101c263..bd732ffebc85 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -164,9 +164,8 @@ static int kobject_add_internal(struct kobject *kobj) return -ENOENT; if (!kobj->name || !kobj->name[0]) { - pr_debug("kobject: (%p): attempted to be registered with empty " + WARN(1, "kobject: (%p): attempted to be registered with empty " "name!\n", kobj); - WARN_ON(1); return -EINVAL; } @@ -216,13 +215,19 @@ static int kobject_add_internal(struct kobject *kobj) static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list vargs) { - /* Free the old name, if necessary. */ - kfree(kobj->name); + const char *old_name = kobj->name; + char *s; kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); if (!kobj->name) return -ENOMEM; + /* ewww... some of these buggers have '/' in the name ... */ + s = strchr(kobj->name, '/'); + if (s) + s[0] = '!'; + + kfree(old_name); return 0; } @@ -439,6 +444,7 @@ out: return error; } +EXPORT_SYMBOL_GPL(kobject_rename); /** * kobject_move - move object to another parent @@ -576,12 +582,10 @@ static void kobject_release(struct kref *kref) void kobject_put(struct kobject *kobj) { if (kobj) { - if (!kobj->state_initialized) { - printk(KERN_WARNING "kobject: '%s' (%p): is not " + if (!kobj->state_initialized) + WARN(1, KERN_WARNING "kobject: '%s' (%p): is not " "initialized, yet kobject_put() is being " "called.\n", kobject_name(kobj), kobj); - WARN_ON(1); - } kref_put(&kobj->kref, kobject_release); } } |
