[PATCH] fix dev_printk to work even in the absence of am attacheddriver

From: James Bottomley
Date: Mon Apr 19 2004 - 15:42:57 EST

dev_printk makes an incredibly convenient hook to hang a logging
infrastructure. For that reason, it would be very useful to make all
device driver logging go through it.

Unfortunately in SCSI we can't do this yet because we need to log
messages even when the device doesn't have a bound driver (either
because the user has chosen not to load it or because we're starting up
or shutting down).

The attached makes dev_printk work even in the absence of a bound driver
so we should now be able to use it at all points in the lifecycle of a
SCSI device.

Index: include/linux/device.h
RCS file: /var/cvs/linux-2.6/include/linux/device.h,v
retrieving revision 1.9
diff -u -r1.9 device.h
--- a/include/linux/device.h 15 Apr 2004 18:05:25 -0000 1.9
+++ b/include/linux/device.h 19 Apr 2004 20:36:57 -0000
@@ -400,7 +400,7 @@

/* debugging and troubleshooting/diagnostic helpers. */
#define dev_printk(level, dev, format, arg...) \
- printk(level "%s %s: " format , (dev)->driver->name , (dev)->bus_id , ## arg)
+ printk(level "%s %s: " format , (dev)->driver ? (dev)->driver->name : "(unbound)", (dev)->bus_id , ## arg)

#ifdef DEBUG
#define dev_dbg(dev, format, arg...) \

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/