From: Joe Perches <joe@perches.com>
To: Kay Sievers <kay@vrfy.org>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Len Brown <lenb@kernel.org>
Subject: Re: [PATCH] printk(): add KERN_CONT where needed
Date: Mon, 02 Apr 2012 19:36:52 -0700 [thread overview]
Message-ID: <1333420612.26079.6.camel@joe2Laptop> (raw)
In-Reply-To: <1333415903.860.0.camel@mop>
On Tue, 2012-04-03 at 03:18 +0200, Kay Sievers wrote:
> From: Kay Sievers <kay@vrfy.org>
> Subject: printk(): add KERN_CONT where needed
>
> A prototype for kmsg records instead of a byte-stream buffer revealed
> a couple of missing printk(KERN_CONT ...) uses. Subsequent calls produce
> one record per printk() call, while all should have ended up in a single
> record.
>
> Instead of:
> ACPI: (supports S0 S5)
> ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
> hpet0: at MMIO 0xfed00000, IRQs 2 , 8 , 0
>
> It prints:
> ACPI: (supports S0
> S5
> )
> ACPI: PCI Interrupt Link [LNKA] (IRQs
> 5
> *10
> 11
> )
> hpet0: at MMIO 0xfed00000, IRQs
> 2
> , 8
> , 0
You are going to find many, many _hundreds_ of these.
Maybe it'd be better to aggregate content rather like
printk does. Aggregate until you get a newline or a
new KERN_<LEVEL>
A couple of other trivial comments:
It's better to try to coalesce multiple printks(KERN_CONT
(perhaps it's better to use pr_cont instead too)
Branches with the same printks should be hoisted where
possible.
> --- a/drivers/acpi/pci_link.c
> @@ -720,21 +720,21 @@ static int acpi_pci_link_add(struct acpi
> acpi_device_bid(device));
> for (i = 0; i < link->irq.possible_count; i++) {
> if (link->irq.active == link->irq.possible[i]) {
> - printk(" *%d", link->irq.possible[i]);
> + printk(KERN_CONT " *%d", link->irq.possible[i]);
> found = 1;
> } else
> - printk(" %d", link->irq.possible[i]);
> + printk(KERN_CONT " %d", link->irq.possible[i]);
> }
Hoisting gives:
for (i = 0; ...) {
pr_cont(" %d", link->irq.possible[i]);
if (link->irq.active == link->irq.possible[i])
found = 1;
}
> if (!found)
> - printk(" *%d", link->irq.active);
> + printk(KERN_CONT " *%d", link->irq.active);
>
> if (!link->device->status.enabled)
> - printk(", disabled.");
> + printk(KERN_CONT ", disabled.");
>
> - printk("\n");
> + printk(KERN_CONT "\n");
Coalesced this is:
if (!found)
pr_cont(") *%d%s\n",
link->irq.active,
!link->device->status.enabled ? ", disabled" : "");
else
pr_cont("}%s\n",
!link->device->status.enabled ? ", disabled" : "")
next prev parent reply other threads:[~2012-04-03 2:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-03 1:18 [PATCH] printk(): add KERN_CONT where needed Kay Sievers
2012-04-03 2:36 ` Joe Perches [this message]
2012-04-03 3:00 ` Kay Sievers
2012-04-03 3:03 ` Joe Perches
2012-04-03 3:47 ` Joe Perches
2012-04-03 10:30 ` Kay Sievers
2012-04-03 14:32 ` Joe Perches
2012-04-03 15:50 ` Kay Sievers
2012-04-03 16:05 ` Joe Perches
2012-04-03 16:11 ` Kay Sievers
2012-04-03 16:16 ` Joe Perches
2012-04-03 16:20 ` Kay Sievers
2012-04-03 16:27 ` Joe Perches
2012-04-09 23:08 ` Andrew Morton
2012-04-09 23:37 ` Joe Perches
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=1333420612.26079.6.camel@joe2Laptop \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=kay@vrfy.org \
--cc=lenb@kernel.org \
--cc=linux-kernel@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.