diff options
author | Patrick Delaunay <patrick.delaunay@foss.st.com> | 2022-12-15 12:15:50 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-11 23:02:24 +0300 |
commit | d03799004640abfeb656e9db48d6f9b9e24383fb (patch) | |
tree | e930acd2e053c08c3ae60ab63e6e4ff4e52749f6 /cmd | |
parent | 59dacc319030748817b28cce9c773e15f2b73dc8 (diff) | |
download | u-boot-d03799004640abfeb656e9db48d6f9b9e24383fb.tar.xz |
fastboot: remove #ifdef CONFIG when it is possible
Much of the fastboot code predates the introduction of Kconfig and
has quite a few #ifdefs in it which is unnecessary now that we can use
IS_ENABLED() et al.
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3l
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/fastboot.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/cmd/fastboot.c b/cmd/fastboot.c index b498e4b22b..b94dbd5488 100644 --- a/cmd/fastboot.c +++ b/cmd/fastboot.c @@ -19,8 +19,14 @@ static int do_fastboot_udp(int argc, char *const argv[], uintptr_t buf_addr, size_t buf_size) { -#if CONFIG_IS_ENABLED(UDP_FUNCTION_FASTBOOT) - int err = net_loop(FASTBOOT); + int err; + + if (!CONFIG_IS_ENABLED(UDP_FUNCTION_FASTBOOT)) { + pr_err("Fastboot UDP not enabled\n"); + return CMD_RET_FAILURE; + } + + err = net_loop(FASTBOOT); if (err < 0) { printf("fastboot udp error: %d\n", err); @@ -28,21 +34,21 @@ static int do_fastboot_udp(int argc, char *const argv[], } return CMD_RET_SUCCESS; -#else - pr_err("Fastboot UDP not enabled\n"); - return CMD_RET_FAILURE; -#endif } static int do_fastboot_usb(int argc, char *const argv[], uintptr_t buf_addr, size_t buf_size) { -#if CONFIG_IS_ENABLED(USB_FUNCTION_FASTBOOT) int controller_index; char *usb_controller; char *endp; int ret; + if (!CONFIG_IS_ENABLED(USB_FUNCTION_FASTBOOT)) { + pr_err("Fastboot USB not enabled\n"); + return CMD_RET_FAILURE; + } + if (argc < 2) return CMD_RET_USAGE; @@ -88,10 +94,6 @@ exit: g_dnl_clear_detach(); return ret; -#else - pr_err("Fastboot USB not enabled\n"); - return CMD_RET_FAILURE; -#endif } static int do_fastboot(struct cmd_tbl *cmdtp, int flag, int argc, @@ -148,17 +150,12 @@ NXTARG: return do_fastboot_usb(argc, argv, buf_addr, buf_size); } -#ifdef CONFIG_SYS_LONGHELP -static char fastboot_help_text[] = +U_BOOT_CMD( + fastboot, CONFIG_SYS_MAXARGS, 1, do_fastboot, + "run as a fastboot usb or udp device", "[-l addr] [-s size] usb <controller> | udp\n" "\taddr - address of buffer used during data transfers (" __stringify(CONFIG_FASTBOOT_BUF_ADDR) ")\n" "\tsize - size of buffer used during data transfers (" __stringify(CONFIG_FASTBOOT_BUF_SIZE) ")" - ; -#endif - -U_BOOT_CMD( - fastboot, CONFIG_SYS_MAXARGS, 1, do_fastboot, - "run as a fastboot usb or udp device", fastboot_help_text ); |