[PATCH v5 2/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED
Bin Meng
bmeng.cn at gmail.com
Wed Feb 3 14:37:27 CET 2021
On Wed, Feb 3, 2021 at 9:00 PM Simon Glass <sjg at chromium.org> wrote:
>
> Hi Kory,
>
> On Tue, 2 Feb 2021 at 08:42, 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>
> > ---
> >
> > 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
More information about the U-Boot
mailing list