[PATCH v4 3/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED

Bin Meng bmeng.cn at gmail.com
Tue Feb 2 14:22:55 CET 2021


Hi Kory,

On Tue, Feb 2, 2021 at 7:56 PM Kory Maincent <kory.maincent at bootlin.com> wrote:
>
> Replace all the macro ifdef by IS_ENABLED.
> All of these configs are set in the defconfig files and not in the
> include board headers files.
>
> Signed-off-by: Kory Maincent <kory.maincent at bootlin.com>
> ---
>  cmd/pxe_utils.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
> index b788ee9576..a6e7d27682 100644
> --- a/cmd/pxe_utils.c
> +++ b/cmd/pxe_utils.c
> @@ -340,7 +340,7 @@ static int label_localboot(struct pxe_label *label)
>  /*
>   * Loads fdt overlays specified in 'fdtoverlays'.
>   */
> -#ifdef CONFIG_OF_LIBFDT_OVERLAY
> +#if IS_ENABLED(CONFIG_OF_LIBFDT_OVERLAY)
>  static void label_boot_fdtoverlay(struct cmd_tbl *cmdtp, struct pxe_label *label)
>  {
>         char *fdtoverlay = label->fdtoverlays;
> @@ -492,7 +492,7 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
>                         env_get("gatewayip"), env_get("netmask"));
>         }
>
> -#ifdef CONFIG_CMD_NET
> +#if IS_ENABLED(CONFIG_CMD_NET)

This should use: if (IS_ENABLED(CONFIG_CMD_NET)) to increase build coverage.

>         if (label->ipappend & 0x2) {
>                 int err;
>
> @@ -626,7 +626,7 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
>                                 }
>                         }
>
> -#ifdef CONFIG_OF_LIBFDT_OVERLAY
> +#if IS_ENABLED(CONFIG_OF_LIBFDT_OVERLAY)
>                         if (label->fdtoverlays)
>                                 label_boot_fdtoverlay(cmdtp, label);
>  #endif
> @@ -649,11 +649,11 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
>         /* Try bootm for legacy and FIT format image */
>         if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID)
>                 do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
> -#ifdef CONFIG_CMD_BOOTI
> +#if IS_ENABLED(CONFIG_CMD_BOOTI)
>         /* Try booting an AArch64 Linux kernel image */
>         else
>                 do_booti(cmdtp, 0, bootm_argc, bootm_argv);
> -#elif defined(CONFIG_CMD_BOOTZ)
> +#elif IS_ENABLED(CONFIG_CMD_BOOTZ)
>         /* Try booting a Image */
>         else
>                 do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
> @@ -1428,7 +1428,7 @@ void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)
>         struct menu *m;
>         int err;
>
> -#ifdef CONFIG_CMD_BMP
> +#if IS_ENABLED(CONFIG_CMD_BMP)
>         /* display BMP if available */
>         if (cfg->bmp) {
>                 if (get_relfile(cmdtp, cfg->bmp, image_load_addr)) {
> --

Regards,
Bin


More information about the U-Boot mailing list