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

From: Geert Uytterhoeven
Date: Sun Dec 18 2011 - 05:32:44 EST


2011/12/17 Uwe Kleine-KÃnig <u.kleine-koenig@xxxxxxxxxxxxxx>:
> 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.

Yep, that's expected behavior, as defining pr_fmt() modifies all kernel messages
generated from that module.

> This fixes a build problem on m68k with aufs3 en passant because the
> latter builds with
>
> Â Â Â Âccflags-y += -D'pr_fmt(fmt)=AUFS_NAME"\040%s:%d:%s[%d]:\040"fmt,__func__,__LINE__,current->comm,current->pid'
>
> without providing AUFS_NAME early enough for ack_bad_irq (which is the
> problem of aufs).

Isn't this a problem with (out of tree) aufs?
Why does it put a define that relies on an (apparently sometimes still
undefined)
variable on the build command line?
Any header may contain calls to pr_*().

> Cc: Thorsten Glaser <tg@xxxxxxxxxx>
> Signed-off-by: Uwe Kleine-KÃnig <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---
> Âarch/m68k/include/asm/hardirq.h | Â Â2 +-
> Â1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/m68k/include/asm/hardirq.h b/arch/m68k/include/asm/hardirq.h
> index db30ed2..1f652e0 100644
> --- a/arch/m68k/include/asm/hardirq.h
> +++ b/arch/m68k/include/asm/hardirq.h
> @@ -20,7 +20,7 @@
>
> Âstatic inline void ack_bad_irq(unsigned int irq)
> Â{
> - Â Â Â pr_crit("unexpected IRQ trap at vector %02x\n", irq);
> + Â Â Â printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);

Nack. Nowadays pr_crit(...) is recommended over "printk(KERN_CRIT ...)".

Besides, there are (albeit not that many yet) other callers of pr_*() in
header files. Do you plan to revert them to printk(), too?

Please fix aufs instead. Thanks!

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
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/