lkml.org 
[lkml]   [2009]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: [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


\
 
 \ /
  Last update: 2009-10-18 23:28    [W:0.050 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site