X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fkobject.c;h=718e5101c263596224f7f35b523cea27e093ecd6;hb=24e2de6e28a453cd114b06215df2f9931cd0c342;hp=2c6490370922ccddf939db20e6bf0b71fcbf9526;hpb=ce1d5b23a8d1e19866ab82bdec0dc41fde5273d8;p=linux-2.6-omap-h63xx.git diff --git a/lib/kobject.c b/lib/kobject.c index 2c649037092..718e5101c26 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -90,7 +90,7 @@ static void fill_kobj_path(struct kobject *kobj, char *path, int length) } pr_debug("kobject: '%s' (%p): %s: path = '%s'\n", kobject_name(kobj), - kobj, __FUNCTION__, path); + kobj, __func__, path); } /** @@ -181,7 +181,7 @@ static int kobject_add_internal(struct kobject *kobj) } pr_debug("kobject: '%s' (%p): %s: parent: '%s', set: '%s'\n", - kobject_name(kobj), kobj, __FUNCTION__, + kobject_name(kobj), kobj, __func__, parent ? kobject_name(parent) : "", kobj->kset ? kobject_name(&kobj->kset->kobj) : ""); @@ -196,10 +196,10 @@ static int kobject_add_internal(struct kobject *kobj) printk(KERN_ERR "%s failed for %s with " "-EEXIST, don't try to register things with " "the same name in the same directory.\n", - __FUNCTION__, kobject_name(kobj)); + __func__, kobject_name(kobj)); else printk(KERN_ERR "%s failed for %s (%d)\n", - __FUNCTION__, kobject_name(kobj), error); + __func__, kobject_name(kobj), error); dump_stack(); } else kobj->state_in_sysfs = 1; @@ -216,21 +216,12 @@ static int kobject_add_internal(struct kobject *kobj) static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list vargs) { - va_list aq; - char *name; - - va_copy(aq, vargs); - name = kvasprintf(GFP_KERNEL, fmt, vargs); - va_end(aq); - - if (!name) - return -ENOMEM; - /* Free the old name, if necessary. */ kfree(kobj->name); - /* Now, set the new name */ - kobj->name = name; + kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); + if (!kobj->name) + return -ENOMEM; return 0; } @@ -246,12 +237,12 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, */ int kobject_set_name(struct kobject *kobj, const char *fmt, ...) { - va_list args; + va_list vargs; int retval; - va_start(args, fmt); - retval = kobject_set_name_vargs(kobj, fmt, args); - va_end(args); + va_start(vargs, fmt); + retval = kobject_set_name_vargs(kobj, fmt, vargs); + va_end(vargs); return retval; } @@ -301,12 +292,9 @@ EXPORT_SYMBOL(kobject_init); static int kobject_add_varg(struct kobject *kobj, struct kobject *parent, const char *fmt, va_list vargs) { - va_list aq; int retval; - va_copy(aq, vargs); - retval = kobject_set_name_vargs(kobj, fmt, aq); - va_end(aq); + retval = kobject_set_name_vargs(kobj, fmt, vargs); if (retval) { printk(KERN_ERR "kobject: can not set name properly!\n"); return retval; @@ -540,7 +528,7 @@ static void kobject_cleanup(struct kobject *kobj) const char *name = kobj->name; pr_debug("kobject: '%s' (%p): %s\n", - kobject_name(kobj), kobj, __FUNCTION__); + kobject_name(kobj), kobj, __func__); if (t && !t->release) pr_debug("kobject: '%s' (%p): does not have a release() " @@ -600,7 +588,7 @@ void kobject_put(struct kobject *kobj) static void dynamic_kobj_release(struct kobject *kobj) { - pr_debug("kobject: (%p): %s\n", kobj, __FUNCTION__); + pr_debug("kobject: (%p): %s\n", kobj, __func__); kfree(kobj); } @@ -657,7 +645,7 @@ struct kobject *kobject_create_and_add(const char *name, struct kobject *parent) retval = kobject_add(kobj, parent, "%s", name); if (retval) { printk(KERN_WARNING "%s: kobject_add error: %d\n", - __FUNCTION__, retval); + __func__, retval); kobject_put(kobj); kobj = NULL; } @@ -765,7 +753,7 @@ static void kset_release(struct kobject *kobj) { struct kset *kset = container_of(kobj, struct kset, kobj); pr_debug("kobject: '%s' (%p): %s\n", - kobject_name(kobj), kobj, __FUNCTION__); + kobject_name(kobj), kobj, __func__); kfree(kset); }