public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: "David S. Miller" <davem@davemloft.net>
Cc: lkml@rtr.ca, linux-kernel@vger.kernel.org, torvalds@osdl.org,
	davej@redhat.com
Subject: Re: [PATCH] Fix bytecount result from printk()
Date: 01 Dec 2005 18:23:15 -0700	[thread overview]
Message-ID: <p737jaofg1o.fsf@verdi.suse.de> (raw)
In-Reply-To: <20051201.121554.130875743.davem@davemloft.net>

"David S. Miller" <davem@davemloft.net> writes:

> From: Dave Jones <davej@redhat.com>
> Date: Thu, 1 Dec 2005 12:57:32 -0500
> 
> > On Thu, Dec 01, 2005 at 10:55:49AM -0500, Mark Lord wrote:
> >  > printk() returns a bytecount, which nothing actually appears to use.
> > 
> > We do check it in a few places.
> > 
> > arch/x86_64/kernel/traps.c:                             i += printk(" "); \
> > arch/x86_64/kernel/traps.c:                     i += printk(" <%s> ", id);
> > arch/x86_64/kernel/traps.c:                     i += printk(" <EOE> ");
> > arch/x86_64/kernel/traps.c:                             i += printk(" <IRQ> ");
> > arch/x86_64/kernel/traps.c:                             i += printk(" <EOI> ");
> > drivers/char/mem.c:             ret = printk("%s", tmp);
> 
> Wow, that's amazing. :)

Taking the blame.

> I bet these can easily be removed, and since printk() is such
> a core thing, simplifying it should trump whatever benfits
> these few call sites have from getting a return byte count.

I used it for linewrapping in the oops output.

Actually I would expect more users from sprintf and snprintf
(e.g. common in /proc output to compute the return value of the read) 
and that is exactly the same code path.

If you do the same grep for sn?printf I bet there will be much more hits.

-Andi

  reply	other threads:[~2005-12-01 20:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-01 15:55 [PATCH] Fix bytecount result from printk() Mark Lord
2005-12-01 16:09 ` Linus Torvalds
2005-12-01 16:25   ` Mark Lord
2005-12-01 17:57 ` Dave Jones
2005-12-01 20:15   ` David S. Miller
2005-12-02  1:23     ` Andi Kleen [this message]
2005-12-01 21:09       ` Mark Lord
2005-12-01 21:16         ` Andi Kleen
2005-12-02  2:04   ` Andrew Morton
2005-12-02  2:22     ` Mark Lord
2005-12-01 20:14 ` David S. Miller

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=p737jaofg1o.fsf@verdi.suse.de \
    --to=ak@suse.de \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@rtr.ca \
    --cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox