aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
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')
-rw-r--r--lib/kobject.c23
-rw-r--r--lib/kobject_uevent.c20
2 files changed, 29 insertions, 14 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
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 5886147252d0..51dc4d287add 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -98,7 +98,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
98 int i = 0; 98 int i = 0;
99 int retval = 0; 99 int retval = 0;
100 100
101 pr_debug("%s\n", __FUNCTION__); 101 pr_debug("kobject: '%s' (%p): %s\n",
102 kobject_name(kobj), kobj, __FUNCTION__);
102 103
103 /* search the kset we belong to */ 104 /* search the kset we belong to */
104 top_kobj = kobj; 105 top_kobj = kobj;
@@ -106,7 +107,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
106 top_kobj = top_kobj->parent; 107 top_kobj = top_kobj->parent;
107 108
108 if (!top_kobj->kset) { 109 if (!top_kobj->kset) {
109 pr_debug("kobject attempted to send uevent without kset!\n"); 110 pr_debug("kobject: '%s' (%p): %s: attempted to send uevent "
111 "without kset!\n", kobject_name(kobj), kobj,
112 __FUNCTION__);
110 return -EINVAL; 113 return -EINVAL;
111 } 114 }
112 115
@@ -116,7 +119,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
116 /* skip the event, if the filter returns zero. */ 119 /* skip the event, if the filter returns zero. */
117 if (uevent_ops && uevent_ops->filter) 120 if (uevent_ops && uevent_ops->filter)
118 if (!uevent_ops->filter(kset, kobj)) { 121 if (!uevent_ops->filter(kset, kobj)) {
119 pr_debug("kobject filter function caused the event to drop!\n"); 122 pr_debug("kobject: '%s' (%p): %s: filter function "
123 "caused the event to drop!\n",
124 kobject_name(kobj), kobj, __FUNCTION__);
120 return 0; 125 return 0;
121 } 126 }
122 127
@@ -126,7 +131,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
126 else 131 else
127 subsystem = kobject_name(&kset->kobj); 132 subsystem = kobject_name(&kset->kobj);
128 if (!subsystem) { 133 if (!subsystem) {
129 pr_debug("unset subsystem caused the event to drop!\n"); 134 pr_debug("kobject: '%s' (%p): %s: unset subsystem caused the "
135 "event to drop!\n", kobject_name(kobj), kobj,
136 __FUNCTION__);
130 return 0; 137 return 0;
131 } 138 }
132 139
@@ -166,8 +173,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
166 if (uevent_ops && uevent_ops->uevent) { 173 if (uevent_ops && uevent_ops->uevent) {
167 retval = uevent_ops->uevent(kset, kobj, env); 174 retval = uevent_ops->uevent(kset, kobj, env);
168 if (retval) { 175 if (retval) {
169 pr_debug ("%s - uevent() returned %d\n", 176 pr_debug("kobject: '%s' (%p): %s: uevent() returned "
170 __FUNCTION__, retval); 177 "%d\n", kobject_name(kobj), kobj,
178 __FUNCTION__, retval);
171 goto exit; 179 goto exit;
172 } 180 }
173 } 181 }