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

Tom Tom.Rix at windriver.com
Thu Nov 26 20:12:19 CET 2009


Alessandro Rubini wrote:
> 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.
> 
> 
>  lib_arm/board.c |   62 ++++++++++++++++++++++++++----------------------------
>  1 files changed, 30 insertions(+), 32 deletions(-)
> 

Thanks.
I cleaned the comment up and pushed this to a testing branch
arm/testing-arm_init.

I like the idea of cleaning up the arm init functions.
The board startup is more readable with the weak functions.

I put this in a testing branch because it is a big change that
needs general runtime testing and comments from everyone. I am also
interested in adding other init changes.

When we reach a concenseus, we can move this into next.

Tom


More information about the U-Boot mailing list