[U-Boot] [PATCH V2] arm/board.c: avoid ifdef using weak default functions

Joakim Tjernlund joakim.tjernlund at transmode.se
Thu Nov 26 10:10:57 CET 2009


>
> From: Alessandro Rubini <rubini at unipv.it>
>
> 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 add a board_late_init() function.
> Also, I think the file is more readable without the ifdef stuff.
> This uses two trivial weak functions to provide defaults for all
> functions that were ifdeffed.
>
> This patch was initially rejected in favor of a initcall mechanism
> but that approach is not a work in progress any ore.
> ---
>
> One complaint I got about this is the runtime overhead. Actually,
> normal_nop is two instructions (plus the call to it) and void_nop
> is one instruction (plus the call), similar to the overhead in
> led management for platforms with no leds.

I think (I have proposed this before) that you should get rid of
the init_fnc_t *init_sequence[] array all together. It only
adds relocation overhead(lots of it). Just make the array a function
that calls the init functions directly.

    Jocke



More information about the U-Boot mailing list