From: Simon Glass Date: Sat, 10 Dec 2011 08:44:01 +0000 (+0000) Subject: Convert cmd_usage() calls in common to use a return value X-Git-Tag: v2012.04-rc1~75 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4c12eeb8b55483e48ef98b8a480e2bbacc9f210d;p=u-boot Convert cmd_usage() calls in common to use a return value Change all files in common/ to use CMD_RET_USAGE instead of calling cmd_usage() directly. I'm not completely sure about this patch since the code since impact is small (100 byte or so on ARM) and it might need splitting into smaller patches. But for now here it is. Signed-off-by: Simon Glass --- diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c index 5b08123822..9791423205 100644 --- a/common/cmd_bedbug.c +++ b/common/cmd_bedbug.c @@ -84,7 +84,7 @@ int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) len = dis_last_len; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if ((flag & CMD_FLAG_REPEAT) == 0) { /* New command */ @@ -123,7 +123,7 @@ int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) int rcode = 0; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; printf ("\nEnter '.' when done\n"); mem_addr = simple_strtoul (argv[1], NULL, 16); diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index 682f395b4d..4c29fa34ba 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -102,7 +102,7 @@ static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[ addr = simple_strtoul(argv[1], NULL, 16); break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return (bmp_info(addr)); @@ -126,7 +126,7 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar y = simple_strtoul(argv[3], NULL, 10); break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return (bmp_display(addr, x, y)); @@ -166,7 +166,7 @@ static int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (c) return c->cmd(cmdtp, flag, argc, argv); else - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } U_BOOT_CMD( diff --git a/common/cmd_boot.c b/common/cmd_boot.c index 0afd93964d..a799b338a4 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -43,7 +43,7 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int rcode = 0; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; addr = simple_strtoul(argv[1], NULL, 16); diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 6bfef6292f..93045841f9 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -493,12 +493,12 @@ int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc, } } else { /* Unrecognized command */ - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } if (images.state >= state) { printf("Trying to execute a command out of order\n"); - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } images.state |= state; diff --git a/common/cmd_cache.c b/common/cmd_cache.c index 9778d3bd3b..8dca71fc17 100644 --- a/common/cmd_cache.c +++ b/common/cmd_cache.c @@ -54,7 +54,7 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) icache_status() ? "ON" : "OFF"); return 0; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return 0; } @@ -83,7 +83,7 @@ int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) dcache_status() ? "ON" : "OFF"); return 0; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return 0; diff --git a/common/cmd_dataflash_mmc_mux.c b/common/cmd_dataflash_mmc_mux.c index 1678d6e466..f8f178742d 100644 --- a/common/cmd_dataflash_mmc_mux.c +++ b/common/cmd_dataflash_mmc_mux.c @@ -41,7 +41,7 @@ int do_dataflash_mmc_mux (cmd_tbl_t *cmdtp, int flag, int argc, char * const arg AT91F_GetMuxStatus () ? "MMC" : "SPI"); return 0; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return 0; } diff --git a/common/cmd_date.c b/common/cmd_date.c index f0fa02ae22..335bc05f2a 100644 --- a/common/cmd_date.c +++ b/common/cmd_date.c @@ -93,8 +93,7 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) break; default: - cmd_usage(cmdtp); - rcode = 1; + rcode = CMD_RET_USAGE; } /* switch back to original I2C bus */ diff --git a/common/cmd_dcr.c b/common/cmd_dcr.c index 568e226413..d3bbc36c58 100644 --- a/common/cmd_dcr.c +++ b/common/cmd_dcr.c @@ -45,7 +45,7 @@ int do_getdcr ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] ) /* Validate arguments */ if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Get a DCR */ dcrn = (unsigned short) simple_strtoul (argv[1], NULL, 16); @@ -71,7 +71,7 @@ int do_setdcr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) /* Validate arguments */ if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Set a DCR */ dcrn = (unsigned short) simple_strtoul (argv[1], NULL, 16); @@ -116,7 +116,7 @@ int do_getidcr (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Validate arguments */ if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Find out whether ther is '.' (dot) symbol in the first parameter. */ strncpy (buf, argv[1], sizeof(buf)-1); @@ -170,7 +170,7 @@ int do_setidcr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) /* Validate arguments */ if (argc < 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Find out whether ther is '.' (dot) symbol in the first parameter. */ strncpy (buf, argv[1], sizeof(buf)-1); diff --git a/common/cmd_df.c b/common/cmd_df.c index 9a3c84c38c..f7e5df3e2d 100644 --- a/common/cmd_df.c +++ b/common/cmd_df.c @@ -27,7 +27,7 @@ static int do_df(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } usage: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } U_BOOT_CMD( diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c index a48b3d2052..4a43116e92 100644 --- a/common/cmd_eeprom.c +++ b/common/cmd_eeprom.c @@ -104,7 +104,7 @@ int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) } } - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } #endif diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c index 35fb36194c..79b1e2fb62 100644 --- a/common/cmd_ext2.c +++ b/common/cmd_ext2.c @@ -66,7 +66,7 @@ int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int part_length; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; dev = (int)simple_strtoul (argv[2], &ep, 16); dev_desc = get_dev(argv[1],dev); @@ -163,7 +163,7 @@ int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } if (!filename) { diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c index 4fe410dd32..66e0ef0580 100644 --- a/common/cmd_fdc.c +++ b/common/cmd_fdc.c @@ -744,7 +744,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) boot_drive=simple_strtoul(argv[2], NULL, 10); break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } /* setup FDC and scan for drives */ if(fdc_setup(boot_drive,pCMD,pFG)==FALSE) { diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index 04a5e01947..fbee8614ca 100644 --- a/common/cmd_fdos.c +++ b/common/cmd_fdos.c @@ -72,7 +72,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) name = argv [2]; break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } /* Init physical layer */ diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 9bdeccaa40..9a5c53ec06 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -66,7 +66,7 @@ void set_working_fdt_addr(void *addr) int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Set the address of the fdt @@ -123,7 +123,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) int err; if (argc < 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Set the address and length of the fdt. @@ -175,7 +175,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) * Parameters: Node path, new node to be appended to the path. */ if (argc < 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; pathp = argv[2]; nodep = argv[3]; @@ -211,7 +211,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) * Parameters: Node path, property, optional value. */ if (argc < 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; pathp = argv[2]; prop = argv[3]; @@ -409,7 +409,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) } } else { /* Unrecognized command */ - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } } #ifdef CONFIG_OF_BOARD_SETUP @@ -422,7 +422,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) unsigned long initrd_start = 0, initrd_end = 0; if ((argc != 2) && (argc != 4)) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (argc == 4) { initrd_start = simple_strtoul(argv[2], NULL, 16); @@ -438,7 +438,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) } else { /* Unrecognized command */ - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return 0; diff --git a/common/cmd_fitupd.c b/common/cmd_fitupd.c index 4d1192b5e5..7a3789e3ed 100644 --- a/common/cmd_fitupd.c +++ b/common/cmd_fitupd.c @@ -20,7 +20,7 @@ static int do_fitupd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong addr = 0UL; if (argc > 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (argc == 2) addr = simple_strtoul(argv[1], NULL, 16); diff --git a/common/cmd_flash.c b/common/cmd_flash.c index c6ea25ac5b..0e9b2e3c74 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -335,7 +335,7 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int rcode = 0; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (strcmp(argv[1], "all") == 0) { for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) { @@ -384,7 +384,7 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif if (argc != 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (strcmp(argv[1], "bank") == 0) { bank = simple_strtoul(argv[2], NULL, 16); @@ -405,7 +405,7 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } if (addr_first >= addr_last) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; rcode = flash_sect_erase(addr_first, addr_last); return rcode; @@ -475,7 +475,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; #if !defined(CONFIG_SYS_NO_FLASH) || defined(CONFIG_HAS_DATAFLASH) if (strcmp(argv[1], "off") == 0) @@ -483,7 +483,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) else if (strcmp(argv[1], "on") == 0) p = 1; else - return cmd_usage(cmdtp); + return CMD_RET_USAGE; #endif #ifdef CONFIG_HAS_DATAFLASH @@ -583,7 +583,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif if (argc != 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (strcmp(argv[2], "bank") == 0) { bank = simple_strtoul(argv[3], NULL, 16); @@ -623,7 +623,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } if (addr_first >= addr_last) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; rcode = flash_sect_protect (p, addr_first, addr_last); #endif /* CONFIG_SYS_NO_FLASH */ diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index 915a5c046c..1834246f30 100644 --- a/common/cmd_fpga.c +++ b/common/cmd_fpga.c @@ -255,7 +255,7 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) switch (op) { case FPGA_NONE: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; case FPGA_INFO: rc = fpga_info (dev); @@ -334,7 +334,7 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) default: printf ("Unknown operation\n"); - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return (rc); } diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c index 9cc790aba8..47eee89221 100644 --- a/common/cmd_gpio.c +++ b/common/cmd_gpio.c @@ -38,7 +38,7 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc != 3) show_usage: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; str_cmd = argv[1]; str_gpio = argv[2]; diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index e795139859..2cdc4eda8b 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -190,7 +190,7 @@ static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv u_char *memaddr; if (argc != 5) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * I2C chip address @@ -204,7 +204,7 @@ static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv devaddr = simple_strtoul(argv[2], NULL, 16); alen = get_alen(argv[2]); if (alen > 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Length is the number of objects, not number of bytes. @@ -242,7 +242,7 @@ static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] length = i2c_dp_last_length; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if ((flag & CMD_FLAG_REPEAT) == 0) { /* @@ -261,7 +261,7 @@ static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] addr = simple_strtoul(argv[2], NULL, 16); alen = get_alen(argv[2]); if (alen > 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * If another parameter, it is the length to display. @@ -330,7 +330,7 @@ static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] int count; if ((argc < 4) || (argc > 5)) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Chip is always specified. @@ -343,7 +343,7 @@ static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] addr = simple_strtoul(argv[2], NULL, 16); alen = get_alen(argv[2]); if (alen > 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Value to write is always specified. @@ -392,7 +392,7 @@ static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] ulong err; if (argc < 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Chip is always specified. @@ -405,7 +405,7 @@ static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] addr = simple_strtoul(argv[2], NULL, 16); alen = get_alen(argv[2]); if (alen > 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Count is always specified @@ -451,7 +451,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg int nbytes; if (argc != 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; #ifdef CONFIG_BOOT_RETRY_TIME reset_cmd_timeout(); /* got a good command to get here */ @@ -482,7 +482,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg addr = simple_strtoul(argv[2], NULL, 16); alen = get_alen(argv[2]); if (alen > 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } /* @@ -613,7 +613,7 @@ static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] int delay; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Chip is always specified. @@ -626,7 +626,7 @@ static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] addr = simple_strtoul(argv[2], NULL, 16); alen = get_alen(argv[2]); if (alen > 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Length is the number of objects, not number of bytes. @@ -765,7 +765,7 @@ static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) }; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * Chip is always specified. @@ -1300,7 +1300,7 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) cmd_tbl_t *c; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Strip off leading 'i2c' command argument */ argc--; @@ -1309,9 +1309,9 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) c = find_cmd_tbl(argv[0], &cmd_i2c_sub[0], ARRAY_SIZE(cmd_i2c_sub)); if (c) - return c->cmd(cmdtp, flag, argc, argv); + return c->cmd(cmdtp, flag, argc, argv); else - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } /***************************************************/ diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 305c6029f9..3fb7506ddc 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -179,7 +179,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) switch (argc) { case 0: case 1: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; case 2: if (strncmp(argv[1], "res", 3) == 0) { puts("\nReset IDE" @@ -232,7 +232,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) } return rcode; } - return cmd_usage(cmdtp); + return CMD_RET_USAGE; case 3: if (strncmp(argv[1], "dev", 3) == 0) { int dev = (int) simple_strtoul(argv[2], NULL, 10); @@ -266,7 +266,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) return rcode; } - return cmd_usage(cmdtp); + return CMD_RET_USAGE; default: /* at least 4 args */ @@ -325,7 +325,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) else return 1; } else { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return rcode; @@ -361,7 +361,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) break; default: show_boot_progress(-42); - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } show_boot_progress(42); diff --git a/common/cmd_irq.c b/common/cmd_irq.c index d35a43fc5e..9f158ef6e3 100644 --- a/common/cmd_irq.c +++ b/common/cmd_irq.c @@ -28,7 +28,7 @@ int do_interrupts(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc != 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* on */ if (strncmp(argv[1], "on", 2) == 0) diff --git a/common/cmd_itest.c b/common/cmd_itest.c index 2a238a43e5..d5df758a1f 100644 --- a/common/cmd_itest.c +++ b/common/cmd_itest.c @@ -161,7 +161,7 @@ int do_itest ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] ) /* Validate arguments */ if ((argc != 4)) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Check for a data width specification. * Defaults to long (4) if no specification. diff --git a/common/cmd_led.c b/common/cmd_led.c index f55f94c903..d83b3ba69b 100644 --- a/common/cmd_led.c +++ b/common/cmd_led.c @@ -93,12 +93,12 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Validate arguments */ if ((argc != 3)) { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } cmd = get_led_cmd(argv[2]); if (cmd < 0) { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } for (i = 0; led_commands[i].string; i++) { @@ -132,7 +132,7 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* If we ran out of matches, print Usage */ if (!match) { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return 0; diff --git a/common/cmd_load.c b/common/cmd_load.c index dad03037a0..f4d66deae3 100644 --- a/common/cmd_load.c +++ b/common/cmd_load.c @@ -1102,7 +1102,7 @@ int do_hwflow (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (strcmp(argv[1], "on") == 0) hwflow_onoff(1); else - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } printf("RTS/CTS hardware flow control: %s\n", hwflow_onoff(0) ? "on" : "off"); return 0; diff --git a/common/cmd_log.c b/common/cmd_log.c index 249614f340..f9fbe002c6 100644 --- a/common/cmd_log.c +++ b/common/cmd_log.c @@ -241,10 +241,10 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } return 0; } - return cmd_usage(cmdtp); + return CMD_RET_USAGE; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } } diff --git a/common/cmd_md5sum.c b/common/cmd_md5sum.c index 629a74d4f1..b93dd9b440 100644 --- a/common/cmd_md5sum.c +++ b/common/cmd_md5sum.c @@ -32,7 +32,7 @@ static int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) u8 output[16]; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; addr = simple_strtoul(argv[1], NULL, 16); len = simple_strtoul(argv[2], NULL, 16); diff --git a/common/cmd_mdio.c b/common/cmd_mdio.c index 4ac9de4acf..77d8df12c5 100644 --- a/common/cmd_mdio.c +++ b/common/cmd_mdio.c @@ -193,7 +193,7 @@ static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) struct mii_dev *bus; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * We use the last specified parameters, unless new ones are diff --git a/common/cmd_mem.c b/common/cmd_mem.c index f7e76d6b68..fa6f5991a5 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -74,7 +74,7 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) length = dp_last_length; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if ((flag & CMD_FLAG_REPEAT) == 0) { /* New command specified. Check for a size specification. @@ -168,7 +168,7 @@ int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int size; if ((argc < 3) || (argc > 4)) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Check for size specification. */ @@ -210,7 +210,7 @@ int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong count; if (argc < 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; count = simple_strtoul(argv[3], NULL, 10); @@ -237,7 +237,7 @@ int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong count; if (argc < 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; count = simple_strtoul(argv[3], NULL, 10); @@ -266,7 +266,7 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int rcode = 0; if (argc != 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Check for size specification. */ @@ -352,7 +352,7 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int size; if (argc != 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Check for size specification. */ @@ -478,7 +478,7 @@ int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) volatile u_char *cp; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Check for a size spefication. * Defaults to long if no or incorrect specification. @@ -547,7 +547,7 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) volatile u_char *cp; if (argc < 4) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Check for a size spefication. * Defaults to long if no or incorrect specification. @@ -979,7 +979,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) int nbytes, size; if (argc != 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; #ifdef CONFIG_BOOT_RETRY_TIME reset_cmd_timeout(); /* got a good command to get here */ @@ -1084,7 +1084,7 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong *ptr; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; addr = simple_strtoul (argv[1], NULL, 16); addr += base_address; @@ -1118,7 +1118,7 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc < 3) { usage: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } av = argv + 1; diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c index 00180b0f2c..ddf80d71ff 100644 --- a/common/cmd_mfsl.c +++ b/common/cmd_mfsl.c @@ -38,13 +38,13 @@ int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) unsigned int blocking; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16); blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16); if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) { puts ("Bad number of FSL\n"); - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } switch (fslnum) { @@ -193,13 +193,13 @@ int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) unsigned int blocking; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16); num = (unsigned int)simple_strtoul (argv[2], NULL, 16); blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16); if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; switch (fslnum) { #if (XILINX_FSL_NUMBER > 0) @@ -347,7 +347,7 @@ int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) unsigned int val = 0; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; reg = (unsigned int)simple_strtoul (argv[1], NULL, 16); val = (unsigned int)simple_strtoul (argv[2], NULL, 16); diff --git a/common/cmd_mgdisk.c b/common/cmd_mgdisk.c index d99af2d265..3bd2429c78 100644 --- a/common/cmd_mgdisk.c +++ b/common/cmd_mgdisk.c @@ -54,7 +54,7 @@ int do_mg_disk_cmd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return 0; } diff --git a/common/cmd_mii.c b/common/cmd_mii.c index 23b723eb23..8df44cc42c 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -293,7 +293,7 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) const char *devname; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; #if defined(CONFIG_MII_INIT) mii_init (); @@ -420,7 +420,7 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) else miiphy_set_current_dev (argv[2]); } else { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } /* diff --git a/common/cmd_misc.c b/common/cmd_misc.c index 061b1bbad0..973b1c2082 100644 --- a/common/cmd_misc.c +++ b/common/cmd_misc.c @@ -33,7 +33,7 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong delay; if (argc != 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; delay = simple_strtoul(argv[1], NULL, 10) * CONFIG_SYS_HZ; diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 8f13c22d9b..750509da5e 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -32,7 +32,7 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int dev; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (strcmp(argv[1], "init") == 0) { if (argc == 2) { @@ -43,7 +43,7 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } else if (argc == 3) { dev = (int)simple_strtoul(argv[2], NULL, 10); } else { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } if (mmc_legacy_init(dev) != 0) { @@ -68,12 +68,12 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif curr_device = dev; } else { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } printf("mmc%d is current device\n", curr_device); } else { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return 0; @@ -153,7 +153,7 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) enum mmc_state state; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (curr_device < 0) { if (get_mmc_num() > 0) @@ -216,7 +216,7 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; } } else - return cmd_usage(cmdtp); + return CMD_RET_USAGE; mmc = find_mmc_device(dev); if (!mmc) { @@ -307,7 +307,7 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return (n == cnt) ? 0 : 1; } - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } U_BOOT_CMD( diff --git a/common/cmd_mmc_spi.c b/common/cmd_mmc_spi.c index cfd0fb1136..98cd788c76 100644 --- a/common/cmd_mmc_spi.c +++ b/common/cmd_mmc_spi.c @@ -78,8 +78,7 @@ static int do_mmc_spi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; usage: - cmd_usage(cmdtp); - return 1; + return CMD_RET_USAGE; } U_BOOT_CMD( diff --git a/common/cmd_mp.c b/common/cmd_mp.c index b115b59136..4b27be4956 100644 --- a/common/cmd_mp.c +++ b/common/cmd_mp.c @@ -29,7 +29,7 @@ cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) unsigned long cpuid; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; cpuid = simple_strtoul(argv[1], NULL, 10); if (!is_core_valid(cpuid)) { @@ -46,17 +46,17 @@ cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) else if (strncmp(argv[2], "disable", 7) == 0) return cpu_disable(cpuid); else - return cmd_usage(cmdtp); + return CMD_RET_USAGE; return 0; } /* 4 or greater, make sure its release */ if (strncmp(argv[2], "release", 7) != 0) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (cpu_release(cpuid, argc - 3, argv + 3)) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; return 0; } diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index b7c833b149..22688293ae 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -2035,7 +2035,7 @@ int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return spread_partitions(); #endif /* CONFIG_CMD_MTDPARTS_SPREAD */ - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } /***************************************************/ diff --git a/common/cmd_nand.c b/common/cmd_nand.c index fa96a5201c..035a6f64af 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -358,7 +358,7 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[]) return ret; usage: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } #endif @@ -720,7 +720,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) #endif usage: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } U_BOOT_CMD( @@ -909,7 +909,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) usage: #endif show_boot_progress(-53); - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } show_boot_progress(53); diff --git a/common/cmd_net.c b/common/cmd_net.c index 89519faad3..3dd6810e05 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -231,7 +231,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, #endif default: show_boot_progress (-80); - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } show_boot_progress (80); @@ -271,7 +271,7 @@ int do_ping (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) NetPingIP = string_to_ip(argv[1]); if (NetPingIP == 0) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (NetLoop(PING) < 0) { printf("ping failed; host %s is not alive\n", argv[1]); @@ -377,7 +377,7 @@ U_BOOT_CMD( int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc == 1) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * We should check for a valid hostname: diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 20080dc001..22f98218ea 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -173,7 +173,7 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag, int rcode = 1, arg = 1, idx; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; memset(matched, 0, env_htab.size / 8); @@ -411,7 +411,7 @@ int setenv_addr(const char *varname, const void *addr) int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; return _do_env_set(flag, argc, argv); } @@ -435,7 +435,7 @@ int do_env_ask(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Check the syntax */ switch (argc) { case 1: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; case 2: /* env_ask envname */ sprintf(message, "Please enter '%s':", argv[1]); @@ -493,7 +493,7 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) char *init_val; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* Set read buffer to initial value or empty sting */ init_val = getenv(argv[1]); @@ -631,7 +631,7 @@ static int do_env_default(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc != 2 || strcmp(argv[1], "-f") != 0) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; set_default_env("## Resetting to default environment\n"); return 0; @@ -730,14 +730,14 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag, sep = '\n'; break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } } NXTARG: ; } if (argc < 1) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; addr = (char *)simple_strtoul(argv[0], NULL, 16); @@ -838,13 +838,13 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, del = 1; break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } } } if (argc < 1) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (!fmt) printf("## Warning: defaulting to text format\n"); @@ -944,7 +944,7 @@ static int do_env(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) cmd_tbl_t *cp; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* drop initial "env" arg */ argc--; @@ -955,7 +955,7 @@ static int do_env(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (cp) return cp->cmd(cmdtp, flag, argc, argv); - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } U_BOOT_CMD( diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c index a27adaa61d..0f2e208717 100644 --- a/common/cmd_onenand.c +++ b/common/cmd_onenand.c @@ -390,7 +390,7 @@ static int do_onenand_read(cmd_tbl_t * cmdtp, int flag, int argc, char * const a size_t retlen = 0; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; s = strchr(argv[0], '.'); if ((s != NULL) && (!strcmp(s, ".oob"))) @@ -417,7 +417,7 @@ static int do_onenand_write(cmd_tbl_t * cmdtp, int flag, int argc, char * const size_t retlen = 0; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (strncmp(argv[0] + 6, "yaffs", 5) == 0) withoob = 1; @@ -503,7 +503,7 @@ static int do_onenand_dump(cmd_tbl_t * cmdtp, int flag, int argc, char * const a char *s; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; s = strchr(argv[0], '.'); ofs = (int)simple_strtoul(argv[1], NULL, 16); @@ -525,7 +525,7 @@ static int do_onenand_markbad(cmd_tbl_t * cmdtp, int flag, int argc, char * cons argv += 2; if (argc <= 0) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; while (argc > 0) { addr = simple_strtoul(*argv, NULL, 16); @@ -569,7 +569,7 @@ static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[] cmd_tbl_t *c; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; mtd = &onenand_mtd; @@ -582,7 +582,7 @@ static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[] if (c) return c->cmd(cmdtp, flag, argc, argv); else - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } U_BOOT_CMD( diff --git a/common/cmd_otp.c b/common/cmd_otp.c index eb93eb2db9..6f93335517 100644 --- a/common/cmd_otp.c +++ b/common/cmd_otp.c @@ -89,7 +89,7 @@ int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc < 4) { usage: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } prompt_user = false; diff --git a/common/cmd_pci.c b/common/cmd_pci.c index 1e477bc900..a1fe519f61 100644 --- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -480,7 +480,7 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; usage: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } /***************************************************/ diff --git a/common/cmd_portio.c b/common/cmd_portio.c index 4f2f4997b2..eae8f079d6 100644 --- a/common/cmd_portio.c +++ b/common/cmd_portio.c @@ -44,7 +44,7 @@ int do_portio_out (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) uint value = out_last_value; if (argc != 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if ((flag & CMD_FLAG_REPEAT) == 0) { /* @@ -102,7 +102,7 @@ int do_portio_in (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) uint size = in_last_size; if (argc != 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if ((flag & CMD_FLAG_REPEAT) == 0) { /* diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index 3f69643582..8a68fa1ae3 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -322,7 +322,7 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int err; if (argc != 1) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; pxefile_addr_str = from_env("pxefile_addr_r"); @@ -1312,7 +1312,7 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } else if (argc == 2) { pxefile_addr_str = argv[1]; } else { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } if (strict_strtoul(pxefile_addr_str, 16, &pxefile_addr_r) < 0) { @@ -1344,7 +1344,7 @@ int do_pxe(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) cmd_tbl_t *cp; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* drop initial "pxe" arg */ argc--; @@ -1355,7 +1355,7 @@ int do_pxe(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (cp) return cp->cmd(cmdtp, flag, argc, argv); - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } U_BOOT_CMD( diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c index ced1d40958..fbb9484d0a 100644 --- a/common/cmd_reiser.c +++ b/common/cmd_reiser.c @@ -57,7 +57,7 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int part_length; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; dev = (int)simple_strtoul (argv[2], &ep, 16); dev_desc = get_dev(argv[1],dev); @@ -149,7 +149,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } if (!filename) { diff --git a/common/cmd_sata.c b/common/cmd_sata.c index f62c0cb4f2..7b1703fe41 100644 --- a/common/cmd_sata.c +++ b/common/cmd_sata.c @@ -79,7 +79,7 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) switch (argc) { case 0: case 1: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; case 2: if (strncmp(argv[1],"inf", 3) == 0) { int i; @@ -116,7 +116,7 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } return rc; } - return cmd_usage(cmdtp); + return CMD_RET_USAGE; case 3: if (strncmp(argv[1], "dev", 3) == 0) { int dev = (int)simple_strtoul(argv[2], NULL, 10); @@ -147,7 +147,7 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } return rc; } - return cmd_usage(cmdtp); + return CMD_RET_USAGE; default: /* at least 4 args */ if (strcmp(argv[1], "read") == 0) { @@ -183,7 +183,7 @@ int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) n, (n == cnt) ? "OK" : "ERROR"); return (n == cnt) ? 0 : 1; } else { - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } return rc; diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index fa10751b70..d15b567dbb 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -230,7 +230,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) boot_device = argv[2]; break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } if (!boot_device) { @@ -336,10 +336,11 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { - case 0: - case 1: return cmd_usage(cmdtp); + case 0: + case 1: + return CMD_RET_USAGE; - case 2: + case 2: if (strncmp(argv[1],"res",3) == 0) { printf("\nReset SCSI\n"); scsi_bus_reset(); @@ -384,7 +385,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("\nno SCSI devices available\n"); return 1; } - return cmd_usage(cmdtp); + return CMD_RET_USAGE; case 3: if (strncmp(argv[1],"dev",3) == 0) { int dev = (int)simple_strtoul(argv[2], NULL, 10); @@ -412,7 +413,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } return 1; } - return cmd_usage(cmdtp); + return CMD_RET_USAGE; default: /* at least 4 args */ if (strcmp(argv[1],"read") == 0) { @@ -427,7 +428,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } } /* switch */ - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } /**************************************************************************************** diff --git a/common/cmd_setexpr.c b/common/cmd_setexpr.c index 1ff12329bc..1b3edb7b02 100644 --- a/common/cmd_setexpr.c +++ b/common/cmd_setexpr.c @@ -58,7 +58,7 @@ int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Validate arguments */ if ((argc != 5) || (strlen(argv[3]) != 1)) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; w = cmd_get_data_size(argv[0], 4); diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 98e4162114..9c76464a9a 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -298,7 +298,7 @@ done: return ret; usage: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } U_BOOT_CMD( diff --git a/common/cmd_sha1sum.c b/common/cmd_sha1sum.c index 2b2dd8b45a..2713a14f1f 100644 --- a/common/cmd_sha1sum.c +++ b/common/cmd_sha1sum.c @@ -32,7 +32,7 @@ static int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) u8 output[20]; if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; addr = simple_strtoul(argv[1], NULL, 16); len = simple_strtoul(argv[2], NULL, 16); diff --git a/common/cmd_strings.c b/common/cmd_strings.c index 2986324bc0..41b1665926 100644 --- a/common/cmd_strings.c +++ b/common/cmd_strings.c @@ -15,7 +15,7 @@ static char *start_addr, *last_addr; int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc == 1) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if ((flag & CMD_FLAG_REPEAT) == 0) { start_addr = (char *)simple_strtoul(argv[1], NULL, 16); diff --git a/common/cmd_time.c b/common/cmd_time.c index c937ae4af3..6dbdbbfbe7 100644 --- a/common/cmd_time.c +++ b/common/cmd_time.c @@ -38,7 +38,7 @@ static int run_command_and_time_it(int flag, int argc, char * const argv[], return 1; } if (argc > cmdtp->maxargs) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; /* * TODO(clchiou): get_timer_masked() is only defined in certain ARM @@ -77,7 +77,7 @@ static int do_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int retval = 0; if (argc == 1) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; retval = run_command_and_time_it(0, argc - 1, argv + 1, &cycles); report_time(cycles); diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index 8c1bc23a5a..35b1d31f9c 100644 --- a/common/cmd_ubi.c +++ b/common/cmd_ubi.c @@ -438,7 +438,7 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) int err = 0; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (mtdparts_init() != 0) { printf("Error initializing mtdparts!\n"); @@ -465,7 +465,7 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) } if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; #ifdef CONFIG_CMD_UBIFS /* diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c index 3cd2d8fa82..7752123cd8 100644 --- a/common/cmd_ubifs.c +++ b/common/cmd_ubifs.c @@ -53,7 +53,7 @@ int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int ret; if (argc != 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; vol_name = argv[1]; debug("Using volume %s\n", vol_name); @@ -94,7 +94,7 @@ void cmd_ubifs_umount(void) int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc != 1) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if (ubifs_initialized == 0) { printf("No UBIFS volume mounted!\n"); @@ -141,18 +141,18 @@ int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } if (argc < 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; addr = simple_strtoul(argv[1], &endp, 16); if (endp == argv[1]) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; filename = argv[2]; if (argc == 4) { size = simple_strtoul(argv[3], &endp, 16); if (endp == argv[3]) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } debug("Loading file '%s' to address 0x%08x (size %d)\n", filename, addr, size); diff --git a/common/cmd_unzip.c b/common/cmd_unzip.c index 6483b9267b..43ed7915fd 100644 --- a/common/cmd_unzip.c +++ b/common/cmd_unzip.c @@ -39,7 +39,7 @@ static int do_unzip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) dst = simple_strtoul(argv[2], NULL, 16); break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } if (gunzip((void *) dst, dst_len, (void *) src, &src_len) != 0) diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 320667f5fb..4a86590f17 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -379,7 +379,7 @@ int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) boot_device = argv[2]; break; default: - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } if (!boot_device) { @@ -509,7 +509,7 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; if ((strncmp(argv[1], "reset", 5) == 0) || (strncmp(argv[1], "start", 5) == 0)) { @@ -694,7 +694,7 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } #endif /* CONFIG_USB_STORAGE */ - return cmd_usage(cmdtp); + return CMD_RET_USAGE; } #ifdef CONFIG_USB_STORAGE diff --git a/common/main.c b/common/main.c index 4adc17a9f7..db181d319b 100644 --- a/common/main.c +++ b/common/main.c @@ -1381,7 +1381,7 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) int i; if (argc < 2) - return cmd_usage(cmdtp); + return CMD_RET_USAGE; for (i=1; i