lkml.org 
[lkml]   [2004]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2.6] Fix dev_printk to work with unclaimed devices

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...) \
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:01    [W:0.026 / U:15.604 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site