lkml.org 
[lkml]   [2011]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: help for kernel initcall section (init.h)
From
On Sun, Aug 21, 2011 at 11:54 AM, Pintu Agarwal <pintu_agarwal@yahoo.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

?
\
 
 \ /
  Last update: 2011-08-22 11:11    [W:0.250 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site