X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fkobject.c;h=bd732ffebc85f36cfc30e70fa124f0566701ecba;hb=10546355323e4826d13e62f85ac6198385a817a9;hp=718e5101c263596224f7f35b523cea27e093ecd6;hpb=a15306365a16380f3bafee9e181ba01231d4acd7;p=linux-2.6-omap-h63xx.git diff --git a/lib/kobject.c b/lib/kobject.c index 718e5101c26..bd732ffebc8 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); } }