public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6] Fix dev_printk to work with unclaimed devices
@ 2004-02-26 18:34 Deepak Saxena
  2004-02-26 18:45 ` Linus Torvalds
  2004-02-26 18:53 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Deepak Saxena @ 2004-02-26 18:34 UTC (permalink / raw)
  To: greg; +Cc: akpm, torvalds, linux-kernel


I need to do some fixup in platform_notify() and when trying to 
use the dev_* print functions for informational messages, they OOPs 
b/c the current code assumes that dev->driver exists. This is not the 
case since platform_notify() is called before a device has been attached
to any driver. 

--- linux-2.5-bk/include/linux/device.h	2004-02-10 14:51:49.000000000 -0700
+++ linux-2.6-ds/include/linux/device.h	2004-02-26 11:10:38.000000000 -0700
@@ -395,7 +395,13 @@
 
 /* debugging and troubleshooting/diagnostic helpers. */
 #define dev_printk(level, dev, format, arg...)	\
-	printk(level "%s %s: " format , (dev)->driver->name , (dev)->bus_id , ## arg)
+	do {					\
+		if ((dev)->driver) {		\
+			printk(level "%s %s: " format , (dev)->driver->name , (dev)->bus_id , ## arg);				\
+		} else {			\
+			printk(level "%s (Unclaimed %s bus device): " format , (dev)->bus_id, (dev)->bus->name , ## arg);					\
+		}				\
+	} while (0)
 
 #ifdef DEBUG
 #define dev_dbg(dev, format, arg...)		\


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-26 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-26 18:34 [PATCH 2.6] Fix dev_printk to work with unclaimed devices Deepak Saxena
2004-02-26 18:45 ` Linus Torvalds
2004-02-26 18:53 ` Greg KH
2004-02-26 20:47   ` Deepak Saxena

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox