On Tuesday 25 October 2011 19:05:02 Simon Glass wrote: > On Tue, Oct 25, 2011 at 6:57 AM, Mike Frysinger wrote: > > On Mon, Oct 24, 2011 at 23:52, Simon Glass wrote: > >> +int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > >> +{ > >> + int result; > >> + > >> + result = (cmdtp->cmd)(cmdtp, flag, argc, argv); > >> + if (result) > >> + debug("Command failed, result=%d", result); > >> + return result; > >> +} > > > > i don't think this goes for enough. it should integrate the "if (argc > > > >> cmdtp->maxargs) return cmd_usage(cmdtp);". > > Yes, that might turn this into a patch worth accepting on its merits. > > > and perhaps even the find_cmd(argv[0]) lookup ... > > -mike > > How about if the commands return error codes, one of which means > 'print usage'? Then we might remove 265 calls to cmd_usage and even > reduce code size :-O
i'm not sure hardcoding a specific value across all commands is possible. for most commands, we do just return -1/0/1, which probably should be normalized into 0/1 ... but the overhead with these calls is probably not that bad since we return via it. so the asm isn't a matter of setting up the args, making the call, moving the return into the right place, and then returning ... we set up the args and jump to cmd_usage. for some arches (depending on the calling convention), we might not even have to touch the args since the one arg is already in the right place. you could prototype the overhead: - return cmd_usage(cmdtp); + return -500; but i wouldn't be surprised if there was no difference, or even if this was actually more overhead ... -mike
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