[U-Boot] [RFC] arm/board.c: avoid ifdef using weak default functions
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Thu Jul 23 23:53:10 CEST 2009
On 19:19 Wed 22 Jul , Alessandro Rubini wrote:
> From: Alessandro Rubini <rubini at gnudd.com>
>
> While it's a matter of personal taste, I prefer to avoid ifdef when
> possible. For example, I don't like to add BOARD_LATE_INIT in the
> config file just to have my board_late_init() function called.
>
> This patch (not meant to be applied mainstram, jsut for discussion)
> tries to simplify and make more readable the code in lib_arm/board.c.
> If this is considered useful it can be done more seriously to all
> platforms, and allow over time to remove defines in the class of
> BOARD_LATE_INIT.
>
> A serious reordering will definitely need more time, and this is just
> a quick hack to show the idea; some things are suboptimal like the
> arm_pci_init() thing which has to remain an ifdef and should be fixed
> in a different way (I think all init function should return int
> and print their own messages, to simplify this factoring out, but again
> it's a matter of personal taste).
>
> About the use of weak, I first converted .a to .o, but then found it
> works nonetheless, and led functions are already weak ones in this file.
>
> Is the idea worth pursuing? Or does it conflich with other work in
> progress?
I've already send an RFC about initcall
I'm not in favor a weak function as it will increase the size of U-Boot and
will not be easy to use as we seen a lots of time due to compiler issue
so I think the initcall mecansim will be more generic, more easier to use and
smaller than the current implementation (already tested)
Best Regards,
J.
More information about the U-Boot
mailing list