Re: [PATCH] m68k/irq: don't use pr_crit in an header

Joe Perches
2011-12-18T17:06:50Z

On Sun, 2011-12-18 at 11:42 +0100, Uwe Kleine-König wrote:
> On Sun, Dec 18, 2011 at 11:32:21AM +0100, Geert Uytterhoeven wrote:
> > 2011/12/17 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > > Using pr_crit in an header results in funny messages. Consider
> > > #define pr_fmt(fmt) "mydriver: " fmt
> > > #include <linux/hardirq.h>
> > > which makes the message from ack_bad_irq
> > > mydriver: unexpected IRQ trap...
> > > so better use plain printk with KERN_CRIT directly.

Why or when is that inappropriate?

> I only wondered if it is also desirable to
> have messages in headers modified depending on the module the header is
> included in.
[]
> > Nack. Nowadays pr_crit(...) is recommended over "printk(KERN_CRIT ...)".
> I know that, I just wonder if the proponents of this recommendation are
> aware of the issue when using pr_* in headers. Joe?

I believe it to be a feature rather than a defect.

For instance: commit 256ee435b9a9ee9cca69602fe8046b27ca99fbee

netdevice: Convert printk to pr_info in netif_tx_stop_queue

This allows any caller to be prefaced by any specific
pr_fmt to better identify which device driver is using
this function inappropriately.

cheers, Joe