[PATCH] PM: use kobject_name() to access kobject names
authorDmitry Torokhov <dtor@insightbb.com>
Wed, 11 Apr 2007 05:37:18 +0000 (01:37 -0400)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 11 Apr 2007 22:39:39 +0000 (15:39 -0700)
Noone should use kobj.name directly since it may contain garbage.
Objects with longer names have them stored in separately allocated
memory pointed to by kobj->k_name.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/base/power/main.c

index fdfa3d0cf6afa6f0bf2fb247f54333abfab8f1fc..bbbb973a9d3cbee5cb79d5083a89ebab58f17477 100644 (file)
@@ -54,7 +54,8 @@ int device_pm_add(struct device * dev)
        int error;
 
        pr_debug("PM: Adding info for %s:%s\n",
-                dev->bus ? dev->bus->name : "No Bus", dev->kobj.name);
+                dev->bus ? dev->bus->name : "No Bus",
+                kobject_name(&dev->kobj));
        down(&dpm_list_sem);
        list_add_tail(&dev->power.entry, &dpm_active);
        device_pm_set_parent(dev, dev->parent);
@@ -67,7 +68,8 @@ int device_pm_add(struct device * dev)
 void device_pm_remove(struct device * dev)
 {
        pr_debug("PM: Removing info for %s:%s\n",
-                dev->bus ? dev->bus->name : "No Bus", dev->kobj.name);
+                dev->bus ? dev->bus->name : "No Bus",
+                kobject_name(&dev->kobj));
        down(&dpm_list_sem);
        dpm_sysfs_remove(dev);
        put_device(dev->power.pm_parent);