mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* help for kernel initcall section (init.h)
@ 2011-08-21  3:54 Pintu Agarwal
  2011-08-22  9:08 ` Américo Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Pintu Agarwal @ 2011-08-21  3:54 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-22 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-21  3:54 help for kernel initcall section (init.h) Pintu Agarwal
2011-08-22  9:08 ` Américo Wang
2011-08-22 14:17   ` Pintu Agarwal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®