[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpV7D1s9oisy1Zx6-MeiruEwm3BQ5sg1UqpmraF0BazXuA@mail.gmail.com>
Date: Mon, 22 Aug 2011 17:08:46 +0800
From: Américo Wang <xiyou.wangcong@...il.com>
To: Pintu Agarwal <pintu_agarwal@...oo.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: help for kernel initcall section (init.h)
On Sun, Aug 21, 2011 at 11:54 AM, Pintu Agarwal <pintu_agarwal@...oo.com> wrote:
> 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
Hi,
Why not
X_initcall(foo_initcall);
#ifdef CHARGER_MODE
X_initcall(foo_charger_initcall);
#endif
?
Powered by blists - more mailing lists