* [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header
@ 2021-02-02 15:42 Kory Maincent
2021-02-02 15:42 ` [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Kory Maincent @ 2021-02-02 15:42 UTC (permalink / raw)
To: u-boot
Remove the extern of the header because they are useless.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---
include/command.h | 56 +++++++++++++++++++++++------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/include/command.h b/include/command.h
index e229bf2825..27604758a4 100644
--- a/include/command.h
+++ b/include/command.h
@@ -55,8 +55,8 @@ struct cmd_tbl {
};
#if defined(CONFIG_CMD_RUN)
-extern int do_run(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[]);
+int do_run(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
#endif
/* common/command.c */
@@ -69,7 +69,7 @@ int complete_subcmdv(struct cmd_tbl *cmdtp, int count, int argc,
char *const argv[], char last_char, int maxv,
char *cmdv[]);
-extern int cmd_usage(const struct cmd_tbl *cmdtp);
+int cmd_usage(const struct cmd_tbl *cmdtp);
/* Dummy ->cmd and ->cmd_rep wrappers. */
int cmd_always_repeatable(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -85,10 +85,10 @@ static inline bool cmd_is_repeatable(struct cmd_tbl *cmdtp)
}
#ifdef CONFIG_AUTO_COMPLETE
-extern int var_complete(int argc, char *const argv[], char last_char, int maxv,
- char *cmdv[]);
-extern int cmd_auto_complete(const char *const prompt, char *buf, int *np,
- int *colp);
+int var_complete(int argc, char *const argv[], char last_char, int maxv,
+ char *cmdv[]);
+int cmd_auto_complete(const char *const prompt, char *buf, int *np,
+ int *colp);
#endif
/**
@@ -145,13 +145,13 @@ int cmd_get_data_size(char *arg, int default_size);
#endif
#ifdef CONFIG_CMD_BOOTD
-extern int do_bootd(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[]);
+int do_bootd(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
#endif
#ifdef CONFIG_CMD_BOOTM
-extern int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[]);
-extern int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd);
+int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
+int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd);
#else
static inline int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd)
{
@@ -159,28 +159,28 @@ static inline int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd)
}
#endif
-extern int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[]);
+int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
-extern int do_booti(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[]);
+int do_booti(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
-extern int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
- char *const argv[]);
-
-extern int do_reset(struct cmd_tbl *cmdtp, int flag, int argc,
+int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
char *const argv[]);
-extern int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[]);
-extern unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
- char *const argv[]);
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
+
+unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
+ char *const argv[]);
#if defined(CONFIG_CMD_NVEDIT_EFI)
-extern int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[]);
-extern int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[]);
+int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
+int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
#endif
/**
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED
2021-02-02 15:42 [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
@ 2021-02-02 15:42 ` Kory Maincent
2021-02-03 6:28 ` Bin Meng
2021-02-03 12:59 ` Simon Glass
2021-02-02 15:42 ` [PATCH v5 3/3] sysboot: add zboot support to boot x86 Linux kernel image Kory Maincent
` (2 subsequent siblings)
3 siblings, 2 replies; 9+ messages in thread
From: Kory Maincent @ 2021-02-02 15:42 UTC (permalink / raw)
To: u-boot
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@bootlin.com>
---
Change since v4:
- Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible
cmd/pxe_utils.c | 52 ++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 27 deletions(-)
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index 3526a651d7..e062c9edcf 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,16 +492,16 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
env_get("gatewayip"), env_get("netmask"));
}
-#ifdef CONFIG_CMD_NET
- if (label->ipappend & 0x2) {
- int err;
+ if (IS_ENABLED(CONFIG_CMD_NET)) {
+ if (label->ipappend & 0x2) {
+ int err;
- strcpy(mac_str, " BOOTIF=");
- err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
- if (err < 0)
- mac_str[0] = '\0';
+ strcpy(mac_str, " BOOTIF=");
+ err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
+ if (err < 0)
+ mac_str[0] = '\0';
+ }
}
-#endif
if ((label->ipappend & 0x3) || label->append) {
char bootargs[CONFIG_SYS_CBSIZE] = "";
@@ -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,15 +649,13 @@ 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
/* Try booting an AArch64 Linux kernel image */
- else
+ else if (IS_ENABLED(CONFIG_CMD_BOOTI))
do_booti(cmdtp, 0, bootm_argc, bootm_argv);
-#elif defined(CONFIG_CMD_BOOTZ)
/* Try booting a Image */
- else
+ else if (IS_ENABLED(CONFIG_CMD_BOOTZ))
do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
-#endif
+
unmap_sysmem(buf);
cleanup:
@@ -1424,20 +1422,20 @@ void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)
struct menu *m;
int err;
-#ifdef CONFIG_CMD_BMP
- /* display BMP if available */
- if (cfg->bmp) {
- if (get_relfile(cmdtp, cfg->bmp, image_load_addr)) {
- if (CONFIG_IS_ENABLED(CMD_CLS))
- run_command("cls", 0);
- bmp_display(image_load_addr,
- BMP_ALIGN_CENTER, BMP_ALIGN_CENTER);
- } else {
- printf("Skipping background bmp %s for failure\n",
- cfg->bmp);
+ if (IS_ENABLED(CONFIG_CMD_BMP)) {
+ /* display BMP if available */
+ if (cfg->bmp) {
+ if (get_relfile(cmdtp, cfg->bmp, image_load_addr)) {
+ if (CONFIG_IS_ENABLED(CMD_CLS))
+ run_command("cls", 0);
+ bmp_display(image_load_addr,
+ BMP_ALIGN_CENTER, BMP_ALIGN_CENTER);
+ } else {
+ printf("Skipping background bmp %s for failure\n",
+ cfg->bmp);
+ }
}
}
-#endif
m = pxe_menu_to_menu(cfg);
if (!m)
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v5 3/3] sysboot: add zboot support to boot x86 Linux kernel image
2021-02-02 15:42 [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
2021-02-02 15:42 ` [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
@ 2021-02-02 15:42 ` Kory Maincent
2021-02-03 6:28 ` Bin Meng
2021-02-03 6:28 ` [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header Bin Meng
2021-02-03 12:59 ` Simon Glass
3 siblings, 1 reply; 9+ messages in thread
From: Kory Maincent @ 2021-02-02 15:42 UTC (permalink / raw)
To: u-boot
Add "zboot" command to the list of supported boot in the label_boot
function.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---
Change since v1:
- Modify comment.
Change since v2:
- Update do_zboot to do_zboot_parent function to follow the patch:
5588e776b0
Change since v3:
- Follow review from Simon Glass
- Add clean-up paches
Change since v4:
- Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
cmd/pxe_utils.c | 3 +++
include/command.h | 3 +++
2 files changed, 6 insertions(+)
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index e062c9edcf..4cf31119f4 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -655,6 +655,9 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
/* Try booting a Image */
else if (IS_ENABLED(CONFIG_CMD_BOOTZ))
do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
+ /* Try booting an x86_64 Linux kernel image */
+ else if (IS_ENABLED(CONFIG_CMD_ZBOOT))
+ do_zboot_parent(cmdtp, 0, bootm_argc, bootm_argv, NULL);
unmap_sysmem(buf);
diff --git a/include/command.h b/include/command.h
index 27604758a4..747f8f8095 100644
--- a/include/command.h
+++ b/include/command.h
@@ -165,6 +165,9 @@ int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc,
int do_booti(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
+int do_zboot_parent(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[], int *repeatable);
+
int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
char *const argv[]);
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header
2021-02-02 15:42 [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
2021-02-02 15:42 ` [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
2021-02-02 15:42 ` [PATCH v5 3/3] sysboot: add zboot support to boot x86 Linux kernel image Kory Maincent
@ 2021-02-03 6:28 ` Bin Meng
2021-02-03 12:59 ` Simon Glass
3 siblings, 0 replies; 9+ messages in thread
From: Bin Meng @ 2021-02-03 6:28 UTC (permalink / raw)
To: u-boot
On Tue, Feb 2, 2021 at 11:42 PM Kory Maincent <kory.maincent@bootlin.com> wrote:
>
> Remove the extern of the header because they are useless.
>
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> include/command.h | 56 +++++++++++++++++++++++------------------------
> 1 file changed, 28 insertions(+), 28 deletions(-)
>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED
2021-02-02 15:42 ` [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
@ 2021-02-03 6:28 ` Bin Meng
2021-02-03 12:59 ` Simon Glass
1 sibling, 0 replies; 9+ messages in thread
From: Bin Meng @ 2021-02-03 6:28 UTC (permalink / raw)
To: u-boot
On Tue, Feb 2, 2021 at 11:42 PM Kory Maincent <kory.maincent@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@bootlin.com>
> ---
>
> Change since v4:
> - Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible
>
> cmd/pxe_utils.c | 52 ++++++++++++++++++++++++-------------------------
> 1 file changed, 25 insertions(+), 27 deletions(-)
>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v5 3/3] sysboot: add zboot support to boot x86 Linux kernel image
2021-02-02 15:42 ` [PATCH v5 3/3] sysboot: add zboot support to boot x86 Linux kernel image Kory Maincent
@ 2021-02-03 6:28 ` Bin Meng
0 siblings, 0 replies; 9+ messages in thread
From: Bin Meng @ 2021-02-03 6:28 UTC (permalink / raw)
To: u-boot
On Tue, Feb 2, 2021 at 11:42 PM Kory Maincent <kory.maincent@bootlin.com> wrote:
>
> Add "zboot" command to the list of supported boot in the label_boot
> function.
>
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Change since v1:
> - Modify comment.
>
> Change since v2:
> - Update do_zboot to do_zboot_parent function to follow the patch:
> 5588e776b0
>
> Change since v3:
> - Follow review from Simon Glass
> - Add clean-up paches
>
> Change since v4:
> - Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
>
> cmd/pxe_utils.c | 3 +++
> include/command.h | 3 +++
> 2 files changed, 6 insertions(+)
>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header
2021-02-02 15:42 [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
` (2 preceding siblings ...)
2021-02-03 6:28 ` [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header Bin Meng
@ 2021-02-03 12:59 ` Simon Glass
3 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2021-02-03 12:59 UTC (permalink / raw)
To: u-boot
On Tue, 2 Feb 2021 at 08:42, Kory Maincent <kory.maincent@bootlin.com> wrote:
>
> Remove the extern of the header because they are useless.
>
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> include/command.h | 56 +++++++++++++++++++++++------------------------
> 1 file changed, 28 insertions(+), 28 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED
2021-02-02 15:42 ` [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
2021-02-03 6:28 ` Bin Meng
@ 2021-02-03 12:59 ` Simon Glass
2021-02-03 13:37 ` Bin Meng
1 sibling, 1 reply; 9+ messages in thread
From: Simon Glass @ 2021-02-03 12:59 UTC (permalink / raw)
To: u-boot
Hi Kory,
On Tue, 2 Feb 2021 at 08:42, Kory Maincent <kory.maincent@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@bootlin.com>
> ---
>
> Change since v4:
> - Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible
>
> cmd/pxe_utils.c | 52 ++++++++++++++++++++++++-------------------------
> 1 file changed, 25 insertions(+), 27 deletions(-)
>
> diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
> index 3526a651d7..e062c9edcf 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,16 +492,16 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
> env_get("gatewayip"), env_get("netmask"));
> }
>
> -#ifdef CONFIG_CMD_NET
> - if (label->ipappend & 0x2) {
> - int err;
> + if (IS_ENABLED(CONFIG_CMD_NET)) {
> + if (label->ipappend & 0x2) {
> + int err;
>
> - strcpy(mac_str, " BOOTIF=");
> - err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
> - if (err < 0)
> - mac_str[0] = '\0';
> + strcpy(mac_str, " BOOTIF=");
> + err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
> + if (err < 0)
> + mac_str[0] = '\0';
> + }
> }
> -#endif
>
> if ((label->ipappend & 0x3) || label->append) {
> char bootargs[CONFIG_SYS_CBSIZE] = "";
> @@ -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)
There is actually no point in doing that...just leave it as it is.
IS_ENABLED() is useful when we can move things to the compiler instead
of the preprocessor.
> if (label->fdtoverlays)
> label_boot_fdtoverlay(cmdtp, label);
> #endif
> @@ -649,15 +649,13 @@ 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
> /* Try booting an AArch64 Linux kernel image */
> - else
> + else if (IS_ENABLED(CONFIG_CMD_BOOTI))
> do_booti(cmdtp, 0, bootm_argc, bootm_argv);
> -#elif defined(CONFIG_CMD_BOOTZ)
> /* Try booting a Image */
> - else
> + else if (IS_ENABLED(CONFIG_CMD_BOOTZ))
> do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
> -#endif
> +
> unmap_sysmem(buf);
>
> cleanup:
> @@ -1424,20 +1422,20 @@ void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)
> struct menu *m;
> int err;
>
> -#ifdef CONFIG_CMD_BMP
> - /* display BMP if available */
> - if (cfg->bmp) {
> - if (get_relfile(cmdtp, cfg->bmp, image_load_addr)) {
> - if (CONFIG_IS_ENABLED(CMD_CLS))
> - run_command("cls", 0);
> - bmp_display(image_load_addr,
> - BMP_ALIGN_CENTER, BMP_ALIGN_CENTER);
> - } else {
> - printf("Skipping background bmp %s for failure\n",
> - cfg->bmp);
> + if (IS_ENABLED(CONFIG_CMD_BMP)) {
> + /* display BMP if available */
> + if (cfg->bmp) {
> + if (get_relfile(cmdtp, cfg->bmp, image_load_addr)) {
> + if (CONFIG_IS_ENABLED(CMD_CLS))
> + run_command("cls", 0);
> + bmp_display(image_load_addr,
> + BMP_ALIGN_CENTER, BMP_ALIGN_CENTER);
> + } else {
> + printf("Skipping background bmp %s for failure\n",
> + cfg->bmp);
> + }
> }
> }
> -#endif
>
> m = pxe_menu_to_menu(cfg);
> if (!m)
> --
> 2.17.1
>
Regards,
Simon
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED
2021-02-03 12:59 ` Simon Glass
@ 2021-02-03 13:37 ` Bin Meng
0 siblings, 0 replies; 9+ messages in thread
From: Bin Meng @ 2021-02-03 13:37 UTC (permalink / raw)
To: u-boot
On Wed, Feb 3, 2021 at 9:00 PM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Kory,
>
> On Tue, 2 Feb 2021 at 08:42, Kory Maincent <kory.maincent@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@bootlin.com>
> > ---
> >
> > Change since v4:
> > - Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible
> >
> > cmd/pxe_utils.c | 52 ++++++++++++++++++++++++-------------------------
> > 1 file changed, 25 insertions(+), 27 deletions(-)
> >
> > diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
> > index 3526a651d7..e062c9edcf 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,16 +492,16 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
> > env_get("gatewayip"), env_get("netmask"));
> > }
> >
> > -#ifdef CONFIG_CMD_NET
> > - if (label->ipappend & 0x2) {
> > - int err;
> > + if (IS_ENABLED(CONFIG_CMD_NET)) {
> > + if (label->ipappend & 0x2) {
> > + int err;
> >
> > - strcpy(mac_str, " BOOTIF=");
> > - err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
> > - if (err < 0)
> > - mac_str[0] = '\0';
> > + strcpy(mac_str, " BOOTIF=");
> > + err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
> > + if (err < 0)
> > + mac_str[0] = '\0';
> > + }
> > }
> > -#endif
> >
> > if ((label->ipappend & 0x3) || label->append) {
> > char bootargs[CONFIG_SYS_CBSIZE] = "";
> > @@ -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)
>
> There is actually no point in doing that...just leave it as it is.
> IS_ENABLED() is useful when we can move things to the compiler instead
> of the preprocessor.
>
I will fix this up in the tree. Thanks!
Regards,
Bin
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-02-03 13:37 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 15:42 [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
2021-02-02 15:42 ` [PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
2021-02-03 6:28 ` Bin Meng
2021-02-03 12:59 ` Simon Glass
2021-02-03 13:37 ` Bin Meng
2021-02-02 15:42 ` [PATCH v5 3/3] sysboot: add zboot support to boot x86 Linux kernel image Kory Maincent
2021-02-03 6:28 ` Bin Meng
2021-02-03 6:28 ` [PATCH v5 1/3] command.h: Clean-up patch, remove extern from the header Bin Meng
2021-02-03 12:59 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.