Re: [PATCH] fix dev_printk to work even in the absence of amattached driver

From: James Bottomley
Date: Tue May 11 2004 - 09:02:31 EST


On Thu, 2004-04-22 at 17:07, Greg KH wrote:
> But doesn't this cause the string "(unbound)" to be created for every
> dev_printk() call in the code? I don't think gcc can optimize that very
> well. How about making a global string just for that, otherwise the
> size police will come after me for adding such a patch :)

OK, I can't find an elegant way of making it global, so I think the best
thing to do is just leave it blank for no driver (gcc can optimise that
case).

James

===== include/linux/device.h 1.117 vs edited =====
--- 1.117/include/linux/device.h Mon Apr 12 12:54:25 2004
+++ edited/include/linux/device.h Tue May 11 08:58:44 2004
@@ -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 : "" , (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/