Message ID | 20230222013821.1144691-22-troykiskyboundary@gmail.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | CONFIG_IS_ENABLED vs IS_ENABLED | expand |
On Tue, Feb 21, 2023 at 05:38:18PM -0800, Troy Kisky wrote: > This is the same as the definition is surrounded by. > It avoids an error in converting to CONFIG_IS_ENABLED(NET). > > Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com> > --- > > board/gateworks/venice/venice.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/board/gateworks/venice/venice.c b/board/gateworks/venice/venice.c > index c4d86c26a9b..ad27835caaf 100644 > --- a/board/gateworks/venice/venice.c > +++ b/board/gateworks/venice/venice.c > @@ -41,7 +41,7 @@ int board_fit_config_name_match(const char *name) > return -1; > } > > -#if (IS_ENABLED(CONFIG_NET)) > +#if IS_ENABLED(CONFIG_NET) > static int setup_fec(void) > { > struct iomuxc_gpr_base_regs *gpr = > @@ -113,10 +113,12 @@ int board_init(void) > { > venice_eeprom_init(1); > > +#if IS_ENABLED(CONFIG_NET) > if (IS_ENABLED(CONFIG_FEC_MXC)) > setup_fec(); > if (IS_ENABLED(CONFIG_DWC_ETH_QOS)) > setup_eqos(); > +#endif > > return 0; > } We should be able to not-guard setup_fec (and setup_eqos), as if (IS_ENABLED(...)) will lead to the compiler optimizing it all away, but if (0) { func() } shouldn't result in unused function warnings.
diff --git a/board/gateworks/venice/venice.c b/board/gateworks/venice/venice.c index c4d86c26a9b..ad27835caaf 100644 --- a/board/gateworks/venice/venice.c +++ b/board/gateworks/venice/venice.c @@ -41,7 +41,7 @@ int board_fit_config_name_match(const char *name) return -1; } -#if (IS_ENABLED(CONFIG_NET)) +#if IS_ENABLED(CONFIG_NET) static int setup_fec(void) { struct iomuxc_gpr_base_regs *gpr = @@ -113,10 +113,12 @@ int board_init(void) { venice_eeprom_init(1); +#if IS_ENABLED(CONFIG_NET) if (IS_ENABLED(CONFIG_FEC_MXC)) setup_fec(); if (IS_ENABLED(CONFIG_DWC_ETH_QOS)) setup_eqos(); +#endif return 0; }
This is the same as the definition is surrounded by. It avoids an error in converting to CONFIG_IS_ENABLED(NET). Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com> --- board/gateworks/venice/venice.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)