diff mbox series

[U-Boot,v2,18/38] x86: fsp: Use if() instead of #ifdef

Message ID 20190925141147.191166-19-sjg@chromium.org
State Accepted
Delegated to: Bin Meng
Headers show
Series x86: Various modifications to prepare for FSP2 | expand

Commit Message

Simon Glass Sept. 25, 2019, 2:11 p.m. UTC
Update a few #ifdefs to if() to improve build coverage.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/x86/lib/fsp1/fsp_common.c | 9 ++++-----
 arch/x86/lib/fsp1/fsp_dram.c   | 8 ++------
 2 files changed, 6 insertions(+), 11 deletions(-)

Comments

Bin Meng Oct. 3, 2019, 8:16 a.m. UTC | #1
On Wed, Sep 25, 2019 at 10:12 PM Simon Glass <sjg@chromium.org> wrote:
>
> Update a few #ifdefs to if() to improve build coverage.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  arch/x86/lib/fsp1/fsp_common.c | 9 ++++-----
>  arch/x86/lib/fsp1/fsp_dram.c   | 8 ++------
>  2 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/arch/x86/lib/fsp1/fsp_common.c b/arch/x86/lib/fsp1/fsp_common.c
> index 591eef7b813..bfd76dccbab 100644
> --- a/arch/x86/lib/fsp1/fsp_common.c
> +++ b/arch/x86/lib/fsp1/fsp_common.c
> @@ -116,11 +116,10 @@ int arch_fsp_init(void)
>  #endif
>
>         if (!gd->arch.hob_list) {
> -#ifdef CONFIG_ENABLE_MRC_CACHE
> -               nvs = fsp_prepare_mrc_cache();
> -#else
> -               nvs = NULL;
> -#endif
> +               if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE))
> +                       nvs = fsp_prepare_mrc_cache();
> +               else
> +                       nvs = NULL;
>
>  #ifdef CONFIG_HAVE_ACPI_RESUME
>                 if (prev_sleep_state == ACPI_S3) {
> diff --git a/arch/x86/lib/fsp1/fsp_dram.c b/arch/x86/lib/fsp1/fsp_dram.c
> index 3bf65b495ca..961e963362a 100644
> --- a/arch/x86/lib/fsp1/fsp_dram.c
> +++ b/arch/x86/lib/fsp1/fsp_dram.c
> @@ -29,13 +29,9 @@ int dram_init(void)
>                 hdr = get_next_hob(hdr);
>         }
>
> -       gd->ram_size = ram_size;
> -       post_code(POST_DRAM);

These should not be removed.

I will fix this when applying.

> -
> -#ifdef CONFIG_ENABLE_MRC_CACHE
> -       gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list,
> +       if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE))
> +               gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list,
>                                                &gd->arch.mrc_output_len);
> -#endif
>
>         return 0;
>  }
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng Oct. 3, 2019, 8:23 a.m. UTC | #2
On Thu, Oct 3, 2019 at 4:16 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Wed, Sep 25, 2019 at 10:12 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > Update a few #ifdefs to if() to improve build coverage.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> > Changes in v2: None
> >
> >  arch/x86/lib/fsp1/fsp_common.c | 9 ++++-----
> >  arch/x86/lib/fsp1/fsp_dram.c   | 8 ++------
> >  2 files changed, 6 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/x86/lib/fsp1/fsp_common.c b/arch/x86/lib/fsp1/fsp_common.c
> > index 591eef7b813..bfd76dccbab 100644
> > --- a/arch/x86/lib/fsp1/fsp_common.c
> > +++ b/arch/x86/lib/fsp1/fsp_common.c
> > @@ -116,11 +116,10 @@ int arch_fsp_init(void)
> >  #endif
> >
> >         if (!gd->arch.hob_list) {
> > -#ifdef CONFIG_ENABLE_MRC_CACHE
> > -               nvs = fsp_prepare_mrc_cache();
> > -#else
> > -               nvs = NULL;
> > -#endif
> > +               if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE))
> > +                       nvs = fsp_prepare_mrc_cache();
> > +               else
> > +                       nvs = NULL;
> >
> >  #ifdef CONFIG_HAVE_ACPI_RESUME
> >                 if (prev_sleep_state == ACPI_S3) {
> > diff --git a/arch/x86/lib/fsp1/fsp_dram.c b/arch/x86/lib/fsp1/fsp_dram.c
> > index 3bf65b495ca..961e963362a 100644
> > --- a/arch/x86/lib/fsp1/fsp_dram.c
> > +++ b/arch/x86/lib/fsp1/fsp_dram.c
> > @@ -29,13 +29,9 @@ int dram_init(void)
> >                 hdr = get_next_hob(hdr);
> >         }
> >
> > -       gd->ram_size = ram_size;
> > -       post_code(POST_DRAM);
>
> These should not be removed.
>
> I will fix this when applying.
>
> > -
> > -#ifdef CONFIG_ENABLE_MRC_CACHE
> > -       gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list,
> > +       if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE))
> > +               gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list,
> >                                                &gd->arch.mrc_output_len);
> > -#endif
> >
> >         return 0;
> >  }
> > --
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Fixed the issues, and

applied to u-boot-x86/next, thanks!
diff mbox series

Patch

diff --git a/arch/x86/lib/fsp1/fsp_common.c b/arch/x86/lib/fsp1/fsp_common.c
index 591eef7b813..bfd76dccbab 100644
--- a/arch/x86/lib/fsp1/fsp_common.c
+++ b/arch/x86/lib/fsp1/fsp_common.c
@@ -116,11 +116,10 @@  int arch_fsp_init(void)
 #endif
 
 	if (!gd->arch.hob_list) {
-#ifdef CONFIG_ENABLE_MRC_CACHE
-		nvs = fsp_prepare_mrc_cache();
-#else
-		nvs = NULL;
-#endif
+		if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE))
+			nvs = fsp_prepare_mrc_cache();
+		else
+			nvs = NULL;
 
 #ifdef CONFIG_HAVE_ACPI_RESUME
 		if (prev_sleep_state == ACPI_S3) {
diff --git a/arch/x86/lib/fsp1/fsp_dram.c b/arch/x86/lib/fsp1/fsp_dram.c
index 3bf65b495ca..961e963362a 100644
--- a/arch/x86/lib/fsp1/fsp_dram.c
+++ b/arch/x86/lib/fsp1/fsp_dram.c
@@ -29,13 +29,9 @@  int dram_init(void)
 		hdr = get_next_hob(hdr);
 	}
 
-	gd->ram_size = ram_size;
-	post_code(POST_DRAM);
-
-#ifdef CONFIG_ENABLE_MRC_CACHE
-	gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list,
+	if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE))
+		gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list,
 					       &gd->arch.mrc_output_len);
-#endif
 
 	return 0;
 }