]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
dev_printk and new-style class devices
authorJean Delvare <khali@linux-fr.org>
Fri, 9 Mar 2007 15:33:10 +0000 (16:33 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Apr 2007 17:57:28 +0000 (10:57 -0700)
As the new-style class devices (as opposed to old-style struct
class_device) are becoming more widely used, I noticed that the
dev_printk-based functions are not working properly with these.
New-style class devices have no driver nor bus, almost by definition,
and as a result dev_driver_string(), which is used as the first
parameter of dev_printk, resolves to an empty string. This causes
entries like the following to show in my logs:

 i2c-2: adapter [SMBus stub driver] registered

Notice the unaesthetical leading whitespace. In order to fix this
problem, I suggest that we extend dev_driver_string to deal with
new-style class devices:

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/core.c

index 658eae5dacda194d7d3396b16616e124b6cdedd4..9ea12d9b48a68056edc13a690b1af7561aac37c4 100644 (file)
@@ -43,7 +43,8 @@ int (*platform_notify_remove)(struct device * dev) = NULL;
 const char *dev_driver_string(struct device *dev)
 {
        return dev->driver ? dev->driver->name :
-                       (dev->bus ? dev->bus->name : "");
+                       (dev->bus ? dev->bus->name :
+                       (dev->class ? dev->class->name : ""));
 }
 EXPORT_SYMBOL(dev_driver_string);