diff mbox series

[v1,21/24] gateworks: venice: surround call of setup_fec with if IS_ENABLED(CONFIG_NET)

Message ID 20230222013821.1144691-22-troykiskyboundary@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show
Series CONFIG_IS_ENABLED vs IS_ENABLED | expand

Commit Message

Troy Kisky Feb. 22, 2023, 1:38 a.m. UTC
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(-)

Comments

Tom Rini Feb. 22, 2023, 3:07 p.m. UTC | #1
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 mbox series

Patch

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;
 }