
On Monday 14 May 2012 12:10:48 Timur Tabi wrote:
Mike Frysinger wrote:
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;
}
Ah, I see. This forces the board-specific function to call saveenv(). That gives us more flexibility in the board code.
However, I was trying to mimic what we have in the NAND layer, with nand_get_device() and nand_release_device(). That is, before we save the environment, we have to "get" it, and then after we save it, we can "release" it.
i don't think the nand approach is terribly applicable. different solutions for different cases.
Your approach, although it eliminates two weak functions, is not as "architecturally clean" as mine, IMHO.
i'd prefer my approach because it keeps down the bloat for the vast majority of people out there while not restricting boards who want this override -mike