summaryrefslogtreecommitdiffstats
path: root/lib/kobject.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-03-15 09:23:43 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-15 09:38:55 -0400
commit82d1f1178a8578599fb52e697ee8ce8b68f1efd0 (patch)
tree6627bd0bbded2f5f0d503bd45d94e350f1d9d2a7 /lib/kobject.c
parent3aaba245dfa33270a464d3098b8cce2a2af32784 (diff)
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/kobject.c')
-rw-r--r--lib/kobject.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index afd5a3fc6123..e1d1f290bf35 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -204,8 +204,9 @@ static int kobject_add_internal(struct kobject *kobj)
204 return -ENOENT; 204 return -ENOENT;
205 205
206 if (!kobj->name || !kobj->name[0]) { 206 if (!kobj->name || !kobj->name[0]) {
207 WARN(1, "kobject: (%p): attempted to be registered with empty " 207 WARN(1,
208 "name!\n", kobj); 208 "kobject: (%p): attempted to be registered with empty name!\n",
209 kobj);
209 return -EINVAL; 210 return -EINVAL;
210 } 211 }
211 212
@@ -232,9 +233,8 @@ static int kobject_add_internal(struct kobject *kobj)
232 233
233 /* be noisy on error issues */ 234 /* be noisy on error issues */
234 if (error == -EEXIST) 235 if (error == -EEXIST)
235 WARN(1, "%s failed for %s with " 236 WARN(1,
236 "-EEXIST, don't try to register things with " 237 "%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n",
237 "the same name in the same directory.\n",
238 __func__, kobject_name(kobj)); 238 __func__, kobject_name(kobj));
239 else 239 else
240 WARN(1, "%s failed for %s (error: %d parent: %s)\n", 240 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 } 334 }
335 if (kobj->state_initialized) { 335 if (kobj->state_initialized) {
336 /* do not error out as sometimes we can recover */ 336 /* do not error out as sometimes we can recover */
337 printk(KERN_ERR "kobject (%p): tried to init an initialized " 337 pr_err("kobject (%p): tried to init an initialized object, something is seriously wrong.\n",
338 "object, something is seriously wrong.\n", kobj); 338 kobj);
339 dump_stack(); 339 dump_stack();
340 } 340 }
341 341
@@ -344,7 +344,7 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
344 return; 344 return;
345 345
346error: 346error:
347 printk(KERN_ERR "kobject (%p): %s\n", kobj, err_str); 347 pr_err("kobject (%p): %s\n", kobj, err_str);
348 dump_stack(); 348 dump_stack();
349} 349}
350EXPORT_SYMBOL(kobject_init); 350EXPORT_SYMBOL(kobject_init);
@@ -357,7 +357,7 @@ static __printf(3, 0) int kobject_add_varg(struct kobject *kobj,
357 357
358 retval = kobject_set_name_vargs(kobj, fmt, vargs); 358 retval = kobject_set_name_vargs(kobj, fmt, vargs);
359 if (retval) { 359 if (retval) {
360 printk(KERN_ERR "kobject: can not set name properly!\n"); 360 pr_err("kobject: can not set name properly!\n");
361 return retval; 361 return retval;
362 } 362 }
363 kobj->parent = parent; 363 kobj->parent = parent;
@@ -399,8 +399,7 @@ int kobject_add(struct kobject *kobj, struct kobject *parent,
399 return -EINVAL; 399 return -EINVAL;
400 400
401 if (!kobj->state_initialized) { 401 if (!kobj->state_initialized) {
402 printk(KERN_ERR "kobject '%s' (%p): tried to add an " 402 pr_err("kobject '%s' (%p): tried to add an uninitialized object, something is seriously wrong.\n",
403 "uninitialized object, something is seriously wrong.\n",
404 kobject_name(kobj), kobj); 403 kobject_name(kobj), kobj);
405 dump_stack(); 404 dump_stack();
406 return -EINVAL; 405 return -EINVAL;
@@ -590,9 +589,9 @@ struct kobject *kobject_get(struct kobject *kobj)
590{ 589{
591 if (kobj) { 590 if (kobj) {
592 if (!kobj->state_initialized) 591 if (!kobj->state_initialized)
593 WARN(1, KERN_WARNING "kobject: '%s' (%p): is not " 592 WARN(1, KERN_WARNING
594 "initialized, yet kobject_get() is being " 593 "kobject: '%s' (%p): is not initialized, yet kobject_get() is being called.\n",
595 "called.\n", kobject_name(kobj), kobj); 594 kobject_name(kobj), kobj);
596 kref_get(&kobj->kref); 595 kref_get(&kobj->kref);
597 } 596 }
598 return kobj; 597 return kobj;
@@ -622,8 +621,7 @@ static void kobject_cleanup(struct kobject *kobj)
622 kobject_name(kobj), kobj, __func__, kobj->parent); 621 kobject_name(kobj), kobj, __func__, kobj->parent);
623 622
624 if (t && !t->release) 623 if (t && !t->release)
625 pr_debug("kobject: '%s' (%p): does not have a release() " 624 pr_debug("kobject: '%s' (%p): does not have a release() function, it is broken and must be fixed.\n",
626 "function, it is broken and must be fixed.\n",
627 kobject_name(kobj), kobj); 625 kobject_name(kobj), kobj);
628 626
629 /* send "remove" if the caller did not do it but sent "add" */ 627 /* send "remove" if the caller did not do it but sent "add" */
@@ -686,9 +684,9 @@ void kobject_put(struct kobject *kobj)
686{ 684{
687 if (kobj) { 685 if (kobj) {
688 if (!kobj->state_initialized) 686 if (!kobj->state_initialized)
689 WARN(1, KERN_WARNING "kobject: '%s' (%p): is not " 687 WARN(1, KERN_WARNING
690 "initialized, yet kobject_put() is being " 688 "kobject: '%s' (%p): is not initialized, yet kobject_put() is being called.\n",
691 "called.\n", kobject_name(kobj), kobj); 689 kobject_name(kobj), kobj);
692 kref_put(&kobj->kref, kobject_release); 690 kref_put(&kobj->kref, kobject_release);
693 } 691 }
694} 692}
@@ -752,8 +750,7 @@ struct kobject *kobject_create_and_add(const char *name, struct kobject *parent)
752 750
753 retval = kobject_add(kobj, parent, "%s", name); 751 retval = kobject_add(kobj, parent, "%s", name);
754 if (retval) { 752 if (retval) {
755 printk(KERN_WARNING "%s: kobject_add error: %d\n", 753 pr_warn("%s: kobject_add error: %d\n", __func__, retval);
756 __func__, retval);
757 kobject_put(kobj); 754 kobject_put(kobj);
758 kobj = NULL; 755 kobj = NULL;
759 } 756 }