All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Prefix each line of multiline printk(KERN_<level> "foo\nbar") with KERN_<level>
Date: Sun, 26 Aug 2007 10:36:30 -0700	[thread overview]
Message-ID: <1188149790.18004.44.camel@localhost> (raw)
In-Reply-To: <Pine.LNX.4.64.0708261028120.31149@anakin>

On Sun, 2007-08-26 at 10:30 +0200, Geert Uytterhoeven wrote: 
> On Fri, 24 Aug 2007, Joe Perches wrote:
> > Corrected printk calls with multiple output lines which
> > did not correctly preface each line with KERN_<level>
> > Fixed uses of some single lines with too many KERN_<level>
> > --- a/arch/arm/kernel/ecard.c
> > +++ b/arch/arm/kernel/ecard.c
> > @@ -547,7 +547,8 @@ static void ecard_check_lockup(struct irq_desc *desc)
> >  	if (last == jiffies) {
> >  		lockup += 1;
> >  		if (lockup > 1000000) {
> > -			printk(KERN_ERR "\nInterrupt lockup detected - "
> > +			printk(KERN_ERR "\n"
> > +			       KERN_ERR "Interrupt lockup detected - "
> >  			       "disabling all expansion card interrupts\n");
> >  
> >  			desc->chip->mask(IRQ_EXPANSIONCARD);
> 
> What's the purpose of having lines printed with e.g. `KERN_ERR "\n"' only?
> Shouldn't these just be removed?

My preference too.  There could be a separate effort for that.

egrep -r --include=*.[ch] "KERN_[A-Z]*[[:space:]]+\"\\\n" * | wc -l
104

These are either errors or a desire to prettify logs with
vertical whitespace.  I think vertical whitespace doesn't help.

> Usually lines starting with `\n' are continuations, but given some other
> module may call printk() in between, there's no guarantee continuations
> appear on the same line.

printk KERN_<level>s were sometimes bolted on after code was written.

etherfoo_card_init()
{
	printk(KERN_INFO "etherfoo card");
	slot = foo_getslot();
	if (slot < 0) {
		printk("\n" KERN_ERR "etherfoo card slot not found\n");
		return -1;
	}
	printk(" found in slot %d", slot);
	irq = foo_getirq();
	if (irq < 0) {
		printk("\n" KERN_ERR "etherfoo card irq not found\n");
		return -1;
	}
	printk(" with irq %d\n", irq);
}

Sometimes, a KERN_ERR is misplaced, or the "\n" is missing.

	printk(KERN_ERR "\n" msg);
or
	printk(KERN_ERR msg);

To me, the card announcement printk should move to the
end of the card_init routine and just be a single printk.

etherfoo_card_init()
{
	slot = foo_getslot();
	if (slot < 0) {
		printk(KERN_ERR "etherfoo card slot not found\n");
		return -1;
	}
	irq = foo_getirq();
	if (irq < 0) {
		printk(KERN_ERR "etherfoo card irq not found\n");
		return -1;
	}
	printk(KERN_INFO "etherfoo card in slot %d with irq %d\n",
	       slot, irq);
}



      parent reply	other threads:[~2007-08-26 17:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24 23:44 [PATCH] Prefix each line of multiline printk(KERN_<level> "foo\nbar") with KERN_<level> Joe Perches
2007-08-24 23:44 ` Joe Perches
2007-08-24 23:44 ` Joe Perches
2007-08-26  8:30 ` Geert Uytterhoeven
2007-08-26  8:30   ` Geert Uytterhoeven
2007-08-26  8:30   ` Geert Uytterhoeven
2007-08-26 10:54   ` Mike Frysinger
2007-08-26 10:54     ` Mike Frysinger
2007-08-26 10:54     ` Mike Frysinger
2007-08-26 11:06     ` Geert Uytterhoeven
2007-08-26 11:06       ` Geert Uytterhoeven
2007-08-26 11:06       ` Geert Uytterhoeven
2007-08-29 11:22       ` [parisc-linux] " Maciej W. Rozycki
2007-08-29 11:22       ` Maciej W. Rozycki
2007-08-29 11:22         ` Maciej W. Rozycki
2007-08-29 11:22         ` Maciej W. Rozycki
2007-08-26 17:36   ` Joe Perches [this message]

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=1188149790.18004.44.camel@localhost \
    --to=joe@perches.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.