Messages in this thread | | | From | Johannes Weiner <> | Subject | printk-wrapper with sectionized string constants [was: Re: [RFC, PATCH] watchdog on gpio] | Date | Mon, 14 Jan 2008 14:56:52 +0100 |
| |
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
| |