[PATCH] fastboot: remove #ifdef CONFIG when it is possible
Tom Rini
trini at konsulko.com
Tue Jan 3 21:35:04 CET 2023
On Thu, Dec 15, 2022 at 10:15:50AM +0100, Patrick Delaunay wrote:
> 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 at foss.st.com>
> ---
>
> cmd/fastboot.c | 35 +++++------
> drivers/fastboot/fb_command.c | 104 ++++++++++++--------------------
> drivers/fastboot/fb_common.c | 11 ++--
> drivers/fastboot/fb_getvar.c | 49 ++++++---------
> drivers/usb/gadget/f_fastboot.c | 7 +--
> include/fastboot.h | 13 ----
> net/fastboot.c | 8 +--
> 7 files changed, 82 insertions(+), 145 deletions(-)
>
> diff --git a/cmd/fastboot.c b/cmd/fastboot.c
> index b498e4b22bb3..b94dbd548843 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
> }
This probably needs to become an if (CONFIG_IS_ENABLED(...)) { ... }
else { ... } in order to remain size-neutral.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230103/13c210d3/attachment.sig>
More information about the U-Boot
mailing list