[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.01.0908251730530.3218@localhost.localdomain>
Date:	Tue, 25 Aug 2009 17:39:08 -0700 (PDT)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Anirban Sinha <ASinha@...gmasystems.com>
cc:	linux-kernel@...r.kernel.org
Subject: RE: [PATCH] console_print: change the function api to make it have
 printk style interface
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists