On Friday 04 May 2012 18:21:31 Timur Tabi wrote: > Introduce board_start_saveenv() and board_finish_saveenv(), two "weak" > functions that are called before and after saving the environment. This > allows for board-specific functions that "prepare" the board for saving > the environment. This is useful if, for some reason, the non-volatile > storage is normally unavailable (e.g. blocked via a mux).
all these board hooks are paper-cutting us to death with unused bloat > --- a/common/cmd_nvedit.c > +++ b/common/cmd_nvedit.c > > #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE) > + > +static int __board_start_saveenv(void) > +{ > + return 0; > +} > +int board_start_saveenv(void) __attribute__((weak, > alias("__board_start_saveenv"))); + > +static void __board_finish_saveenv(void) > +{ > +} > +void board_finish_saveenv(void) __attribute__((weak, > alias("__board_finish_saveenv"))); + > int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > { > + int ret; > + > printf("Saving Environment to %s...\n", env_name_spec); > > - return saveenv() ? 1 : 0; > + ret = board_start_saveenv(); > + if (ret) > + return 0; > + > + ret = saveenv() ? 1 : 0; > + > + board_finish_saveenv(); > + > + return ret; > } this is less bloat: int board_start_saveenv(void) __attribute__((weak, alias("saveenv"))); int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { printf("Saving Environment to %s...\n", env_name_spec); return board_saveenv() ? 1 : 0; }
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot