lkml.org 
[lkml]   [2008]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectprintk-wrapper with sectionized string constants [was: Re: [RFC, PATCH] watchdog on gpio]
Date
Hi,

"Mike Frysinger" <vapier.adi@gmail.com> writes:
>> How about:
>>
>> #define init_printk(fmt, args...) ({ \
>> static const __init char __fmt[] = fmt; \
>> printk(__fmt, args); \
>> })
>>
>> Now it returns the printk result.
>
> i wasnt really worried about that ... i was worried about other random
> things i may have missed

Ok.

> your dropping of ## wont work as you need gcc to expand args and take
> away the , in the simple 1 arg case:
> init_printk("MOO");

Whoops, totally oversaw this one. Of course, this must be in.

Perhaps an even more generic solution would be good, like this:

#define section_printk(sect, fmt, args...) ({ \
static const sect char __fmt[] = fmt; \
printk(__fmt, ## args); \
})

And then just have convenience wrappers like {,dev}init_printk, ... etc.

Can someone please shout at us if there is a fundamental problem with
this approach?

Hannes


\
 
 \ /
  Last update: 2008-01-14 14:59    [W:0.064 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site