mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Anirban Sinha <ASinha@zeugmasystems.com>
Cc: linux-kernel@vger.kernel.org
Subject: RE: [PATCH] console_print: change the function api to make it have printk style interface
Date: Tue, 25 Aug 2009 17:39:08 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0908251730530.3218@localhost.localdomain> (raw)
In-Reply-To: <DDFD17CC94A9BD49A82147DDF7D545C501EA926D@exchange.ZeugmaSystems.local>



On Tue, 25 Aug 2009, Anirban Sinha wrote:
> 
> Ah! Of course you are correct! Can we simply have a macro instead of a
> full blown function instead? If that is not acceptable, I will think of
> something else to get around it.

A macro is what others are generally doing.

I'd suggest looking at "dev_printk()" as an example. Sure, it basically 
requires that the first argument be a string constant (so that the 
automatic concatenations of string constants in C does its job), so it's 
not a _generic_ solution, but it's a very powerful and simple one.

In other words, you'll likely have to change a few existing

	console_print(data);

to

	console_print("%s", data);

to make things work, but hey, not a big deal.

That said, quite frankly, I suspect an even better solution would be to 
just remove the whole 'console_print()' function entirely, and just make 
people use 'printk()' or 'dev_printk()' instead. The only real valid 
reason for that thing existing in the first place is likely the 
_assembler_ interface of doing a printout of an ASCII string (see 
arch/ia64/kernel/head.S).

The other uses of 'console_print()' seem totally pointless, really. It's a 
stupid legacy interface that shouldn't exist, I'm afraid.

		Linus

  reply	other threads:[~2009-08-26  0:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-25 23:47 Anirban Sinha
2009-08-26  0:18 ` Linus Torvalds
2009-08-26  0:28   ` Anirban Sinha
2009-08-26  0:39     ` Linus Torvalds [this message]
2009-08-26  0:57       ` Anirban Sinha
2009-08-26  0:26 ` Randy Dunlap
2009-08-26 20:05   ` Anirban Sinha
2009-08-27 19:34     ` Linus Torvalds
2009-08-27 21:36       ` Anirban Sinha
2009-09-11 19:29       ` [PATCH] cleanup legacy console_print function Anirban Sinha
2009-09-14 14:50         ` Linus Torvalds
2009-09-14 17:18           ` Anirban Sinha

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=alpine.LFD.2.01.0908251730530.3218@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=ASinha@zeugmasystems.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®