[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87prw4jysb.fsf_-_@saeurebad.de>
Date: Mon, 14 Jan 2008 14:56:52 +0100
From: Johannes Weiner <hannes@...urebad.de>
To: "Mike Frysinger" <vapier.adi@...il.com>
Cc: "Alan Cox" <alan@...rguk.ukuu.org.uk>,
"Marc Pignat" <marc.pignat@...s.ch>, wim@...ana.be,
linux-kernel@...r.kernel.org
Subject: printk-wrapper with sectionized string constants [was: Re: [RFC, PATCH] watchdog on gpio]
Hi,
"Mike Frysinger" <vapier.adi@...il.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
--
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