aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kobject.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-29 02:49:41 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:26 -0500
commit9f66fa2a4690a16da0dbaae2f44ddfc313802504 (patch)
tree0cad3298a317626fad0a2a7055ed8905b98e8eb0 /lib/kobject.c
parentcfb36fff45e3997b8044c81045fc4869ba5f281a (diff)
kobject: clean up debugging messages
The kobject debugging messages are a mess. This provides a unified message that makes them actually useful. The format for new kobject debug messages should be: kobject: 'KOBJECT_NAME' (ADDRESS): FUNCTION_NAME: message.\n Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib/kobject.c')
-rw-r--r--lib/kobject.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index 4d52b6f534bc..1015f74212d0 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -95,7 +95,8 @@ static void fill_kobj_path(struct kobject *kobj, char *path, int length)
95 *(path + --length) = '/'; 95 *(path + --length) = '/';
96 } 96 }
97 97
98 pr_debug("%s: path = '%s'\n",__FUNCTION__,path); 98 pr_debug("kobject: '%s' (%p): %s: path = '%s'\n", kobject_name(kobj),
99 kobj, __FUNCTION__,path);
99} 100}
100 101
101/** 102/**
@@ -171,15 +172,17 @@ int kobject_add(struct kobject * kobj)
171 if (!kobj->k_name) 172 if (!kobj->k_name)
172 kobject_set_name(kobj, "NO_NAME"); 173 kobject_set_name(kobj, "NO_NAME");
173 if (!*kobj->k_name) { 174 if (!*kobj->k_name) {
174 pr_debug("kobject attempted to be registered with no name!\n"); 175 pr_debug("kobject (%p) attempted to be registered with no "
176 "name!\n", kobj);
175 WARN_ON(1); 177 WARN_ON(1);
176 kobject_put(kobj); 178 kobject_put(kobj);
177 return -EINVAL; 179 return -EINVAL;
178 } 180 }
179 parent = kobject_get(kobj->parent); 181 parent = kobject_get(kobj->parent);
180 182
181 pr_debug("kobject %s: registering. parent: %s, set: %s\n", 183 pr_debug("kobject: '%s' (%p): %s: parent: '%s', set: '%s'\n",
182 kobject_name(kobj), parent ? kobject_name(parent) : "<NULL>", 184 kobject_name(kobj), kobj, __FUNCTION__,
185 parent ? kobject_name(parent) : "<NULL>",
183 kobj->kset ? kobject_name(&kobj->kset->kobj) : "<NULL>" ); 186 kobj->kset ? kobject_name(&kobj->kset->kobj) : "<NULL>" );
184 187
185 if (kobj->kset) { 188 if (kobj->kset) {
@@ -560,7 +563,8 @@ void kobject_unregister(struct kobject * kobj)
560{ 563{
561 if (!kobj) 564 if (!kobj)
562 return; 565 return;
563 pr_debug("kobject %s: unregistering\n",kobject_name(kobj)); 566 pr_debug("kobject: '%s' (%p): %s\n",
567 kobject_name(kobj), kobj, __FUNCTION__);
564 kobject_uevent(kobj, KOBJ_REMOVE); 568 kobject_uevent(kobj, KOBJ_REMOVE);
565 kobject_del(kobj); 569 kobject_del(kobj);
566 kobject_put(kobj); 570 kobject_put(kobj);
@@ -589,7 +593,8 @@ static void kobject_cleanup(struct kobject *kobj)
589 struct kobject * parent = kobj->parent; 593 struct kobject * parent = kobj->parent;
590 const char *name = kobj->k_name; 594 const char *name = kobj->k_name;
591 595
592 pr_debug("kobject %s: cleaning up\n",kobject_name(kobj)); 596 pr_debug("kobject: '%s' (%p): %s\n",
597 kobject_name(kobj), kobj, __FUNCTION__);
593 if (t && t->release) { 598 if (t && t->release) {
594 t->release(kobj); 599 t->release(kobj);
595 /* If we have a release function, we can guess that this was 600 /* If we have a release function, we can guess that this was
@@ -621,7 +626,8 @@ void kobject_put(struct kobject * kobj)
621 626
622static void dynamic_kobj_release(struct kobject *kobj) 627static void dynamic_kobj_release(struct kobject *kobj)
623{ 628{
624 pr_debug("%s: freeing %s\n", __FUNCTION__, kobject_name(kobj)); 629 pr_debug("kobject: '%s' (%p): %s\n",
630 kobject_name(kobj), kobj, __FUNCTION__);
625 kfree(kobj); 631 kfree(kobj);
626} 632}
627 633
@@ -803,7 +809,8 @@ struct kobject * kset_find_obj(struct kset * kset, const char * name)
803static void kset_release(struct kobject *kobj) 809static void kset_release(struct kobject *kobj)
804{ 810{
805 struct kset *kset = container_of(kobj, struct kset, kobj); 811 struct kset *kset = container_of(kobj, struct kset, kobj);
806 pr_debug("kset %s: now freed\n", kobject_name(kobj)); 812 pr_debug("kobject: '%s' (%p): %s\n",
813 kobject_name(kobj), kobj, __FUNCTION__);
807 kfree(kset); 814 kfree(kset);
808} 815}
809 816