Commit 82d1f117 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

lib/kobject: Join string literals back

There is no need to split string literals. Moreover, it would be simpler
to grep for an actual code line, when debugging, by using almost any
part of the string literal in question.

While here, replace printk(LEVEL) by pr_lvl() macros.

No functional change intended.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3aaba245
...@@ -204,8 +204,9 @@ static int kobject_add_internal(struct kobject *kobj) ...@@ -204,8 +204,9 @@ static int kobject_add_internal(struct kobject *kobj)
return -ENOENT; return -ENOENT;
if (!kobj->name || !kobj->name[0]) { if (!kobj->name || !kobj->name[0]) {
WARN(1, "kobject: (%p): attempted to be registered with empty " WARN(1,
"name!\n", kobj); "kobject: (%p): attempted to be registered with empty name!\n",
kobj);
return -EINVAL; return -EINVAL;
} }
...@@ -232,9 +233,8 @@ static int kobject_add_internal(struct kobject *kobj) ...@@ -232,9 +233,8 @@ static int kobject_add_internal(struct kobject *kobj)
/* be noisy on error issues */ /* be noisy on error issues */
if (error == -EEXIST) if (error == -EEXIST)
WARN(1, "%s failed for %s with " WARN(1,
"-EEXIST, don't try to register things with " "%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n",
"the same name in the same directory.\n",
__func__, kobject_name(kobj)); __func__, kobject_name(kobj));
else else
WARN(1, "%s failed for %s (error: %d parent: %s)\n", WARN(1, "%s failed for %s (error: %d parent: %s)\n",
...@@ -334,8 +334,8 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype) ...@@ -334,8 +334,8 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
} }
if (kobj->state_initialized) { if (kobj->state_initialized) {
/* do not error out as sometimes we can recover */ /* do not error out as sometimes we can recover */
printk(KERN_ERR "kobject (%p): tried to init an initialized " pr_err("kobject (%p): tried to init an initialized object, something is seriously wrong.\n",
"object, something is seriously wrong.\n", kobj); kobj);
dump_stack(); dump_stack();
} }
...@@ -344,7 +344,7 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype) ...@@ -344,7 +344,7 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
return; return;
error: error:
printk(KERN_ERR "kobject (%p): %s\n", kobj, err_str); pr_err("kobject (%p): %s\n", kobj, err_str);
dump_stack(); dump_stack();
} }
EXPORT_SYMBOL(kobject_init); EXPORT_SYMBOL(kobject_init);
...@@ -357,7 +357,7 @@ static __printf(3, 0) int kobject_add_varg(struct kobject *kobj, ...@@ -357,7 +357,7 @@ static __printf(3, 0) int kobject_add_varg(struct kobject *kobj,
retval = kobject_set_name_vargs(kobj, fmt, vargs); retval = kobject_set_name_vargs(kobj, fmt, vargs);
if (retval) { if (retval) {
printk(KERN_ERR "kobject: can not set name properly!\n"); pr_err("kobject: can not set name properly!\n");
return retval; return retval;
} }
kobj->parent = parent; kobj->parent = parent;
...@@ -399,8 +399,7 @@ int kobject_add(struct kobject *kobj, struct kobject *parent, ...@@ -399,8 +399,7 @@ int kobject_add(struct kobject *kobj, struct kobject *parent,
return -EINVAL; return -EINVAL;
if (!kobj->state_initialized) { if (!kobj->state_initialized) {
printk(KERN_ERR "kobject '%s' (%p): tried to add an " pr_err("kobject '%s' (%p): tried to add an uninitialized object, something is seriously wrong.\n",
"uninitialized object, something is seriously wrong.\n",
kobject_name(kobj), kobj); kobject_name(kobj), kobj);
dump_stack(); dump_stack();
return -EINVAL; return -EINVAL;
...@@ -590,9 +589,9 @@ struct kobject *kobject_get(struct kobject *kobj) ...@@ -590,9 +589,9 @@ struct kobject *kobject_get(struct kobject *kobj)
{ {
if (kobj) { if (kobj) {
if (!kobj->state_initialized) if (!kobj->state_initialized)
WARN(1, KERN_WARNING "kobject: '%s' (%p): is not " WARN(1, KERN_WARNING
"initialized, yet kobject_get() is being " "kobject: '%s' (%p): is not initialized, yet kobject_get() is being called.\n",
"called.\n", kobject_name(kobj), kobj); kobject_name(kobj), kobj);
kref_get(&kobj->kref); kref_get(&kobj->kref);
} }
return kobj; return kobj;
...@@ -622,8 +621,7 @@ static void kobject_cleanup(struct kobject *kobj) ...@@ -622,8 +621,7 @@ static void kobject_cleanup(struct kobject *kobj)
kobject_name(kobj), kobj, __func__, kobj->parent); kobject_name(kobj), kobj, __func__, kobj->parent);
if (t && !t->release) if (t && !t->release)
pr_debug("kobject: '%s' (%p): does not have a release() " pr_debug("kobject: '%s' (%p): does not have a release() function, it is broken and must be fixed.\n",
"function, it is broken and must be fixed.\n",
kobject_name(kobj), kobj); kobject_name(kobj), kobj);
/* send "remove" if the caller did not do it but sent "add" */ /* send "remove" if the caller did not do it but sent "add" */
...@@ -686,9 +684,9 @@ void kobject_put(struct kobject *kobj) ...@@ -686,9 +684,9 @@ void kobject_put(struct kobject *kobj)
{ {
if (kobj) { if (kobj) {
if (!kobj->state_initialized) if (!kobj->state_initialized)
WARN(1, KERN_WARNING "kobject: '%s' (%p): is not " WARN(1, KERN_WARNING
"initialized, yet kobject_put() is being " "kobject: '%s' (%p): is not initialized, yet kobject_put() is being called.\n",
"called.\n", kobject_name(kobj), kobj); kobject_name(kobj), kobj);
kref_put(&kobj->kref, kobject_release); kref_put(&kobj->kref, kobject_release);
} }
} }
...@@ -752,8 +750,7 @@ struct kobject *kobject_create_and_add(const char *name, struct kobject *parent) ...@@ -752,8 +750,7 @@ struct kobject *kobject_create_and_add(const char *name, struct kobject *parent)
retval = kobject_add(kobj, parent, "%s", name); retval = kobject_add(kobj, parent, "%s", name);
if (retval) { if (retval) {
printk(KERN_WARNING "%s: kobject_add error: %d\n", pr_warn("%s: kobject_add error: %d\n", __func__, retval);
__func__, retval);
kobject_put(kobj); kobject_put(kobj);
kobj = NULL; kobj = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment