Re: printk regression?

From: Linus Torvalds
Date: Thu Jul 02 2009 - 13:30:19 EST




On Wed, 1 Jul 2009, Joe Perches wrote:
>
> There's at least 72 of them:
>
> $ grep -Pr --include=*.[ch] "\bprintk.*\\\n.*KERN_" *

Yes. Most of these seem to be of the type that have just "\n" in front -
probably exactly because the old code wasn't smart enough to notice the
log-level unless it started a line.

For those cases, the trivial fix is to just remove the "\n". The new world
order for printk is very much a simplification: the log-level is _always_
at the front of the printk, and printk will add the newline automatically
if a log-level exists (unless it's KERN_CONT, of course).

So a simple

sed 's/printk("\n"[ ]*KERN_/printk(KERN_/'

should basically take care of it.

Of course, some cases are just crazy. Here's one:

arch/m68knommu/kernel/traps.c: printk(KERN_CONT "\n" KERN_EMERG " [%08lx] ", addr);

and I have no clue about why it would have KERN_CONT there. That makes
little sense. Again, with the new printk logic, it really should be just

printk(KERN_EMERG " [%08lx] ", addr);

and nothing odd.

Linus
--
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/