public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Deepak Saxena <dsaxena@plexity.net>
To: greg@kroah.com
Cc: akpm@osdl.org, torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2.6] Fix dev_printk to work with unclaimed devices
Date: Thu, 26 Feb 2004 11:34:39 -0700	[thread overview]
Message-ID: <20040226183439.GA17722@plexity.net> (raw)


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...)		\


             reply	other threads:[~2004-02-26 18:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-26 18:34 Deepak Saxena [this message]
2004-02-26 18:45 ` [PATCH 2.6] Fix dev_printk to work with unclaimed devices Linus Torvalds
2004-02-26 18:53 ` Greg KH
2004-02-26 20:47   ` Deepak Saxena

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040226183439.GA17722@plexity.net \
    --to=dsaxena@plexity.net \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox