[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1313898848.75462.YahooMailNeo@web162014.mail.bf1.yahoo.com>
Date: Sat, 20 Aug 2011 20:54:08 -0700 (PDT)
From: Pintu Agarwal <pintu_agarwal@...oo.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: help for kernel initcall section (init.h)
Hi,
I need some help in modifying initcall section in init.h.
That is :
#define __define_initcall(level,fn,id) \
static initcall_t __initcall_##fn##id __used \
__attribute__((__section__(".initcall" level ".init"))) = fn
I have to create two different kinds (and later more) of init section and use one of them based on some condition.
For example, I have one init section for normal mode and one init section for charger mode.
During charger mode, I do not have to execute all the initcall so a charger.initcall is create with lesser init function.
The charger initcall section is as follows:
#define __define_charger_initcall(level,fn,id) \
static initcall_t __charger_initcall_##fn##id __used \
__attribute__((__section__(".charger.initcall" level ".init"))) = fn
Now the problem is that during compile time both of them needs to be polulated based on CHARGER_MODE is enabled or disabled.
How can this decision be taken during compile time under the macro "__define_initcall" ??
Something like :
#define __define_initcall(level,fn,id) \
static initcall_t __initcall_##fn##id __used \
__attribute__((__section__(".initcall" level ".init"))) = fn \
#if defined(CHARGER_MODE) \
static initcall_t __charger_initcall_##fn##id __used \
__attribute__((__section__(".charger.initcall" level ".init"))) = fn \
#endif
Right now this cannot be done, as macro cannot exists inside a macro statement.
If any body have any alternative or better idea of doing this please help.
In gernal, how can I take decision during compile time itself and decide which initcall to be used instead of calling all of them.
Thanks, Regards.
Pintu
--
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