[U-Boot] does it make sense to define misc_init_r() not conditional on CONFIG_MISC_INIT_R?

Simon Glass sjg at chromium.org
Thu Sep 15 16:29:25 CEST 2016


Hi Robert,

On 14 September 2016 at 07:16, Robert P. J. Day <rpjday at crashcourse.ca> wrote:
>
>   another oddity i noted in my travels ... in common/board_r.c, this:
>
>   #ifdef CONFIG_MISC_INIT_R
>         misc_init_r,            /* miscellaneous platform-dependent init */
>   #endif
>
> suggests that any *definition* of a board's misc_init_r() routine
> should be similarly conditional, but there are well over a hundred
> counter-examples like, say, this from km83xx.c:
>
>   int misc_init_r(void)
>   {
>         ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
>         return 0;
>   }
>
>   doesn't hurt, of course ... binary just ends up containing a
> superfluous misc_init_r() routine that's never called. i suspect
> there's a lot of that with other routines as well.
>
>   or is there something else going on here more subtle that i don't
> understand?

Typically the board will define CONFIG_MISC_INIT_R and also provide
the function. The board won't work properly without it. There is a
linkage between the config and the code.

So I don't see any sense in adding #ifdef around the function, if that
is what you are suggesting? But having the function present and not
called does seem odd.

As time moves on and things move to driver model, I suspect a lot of
this init will be turned down.

Regards,
Simon


More information about the U-Boot mailing list