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

Tom Rini trini at konsulko.com
Wed Feb 22 16:07:00 CET 2023


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 at 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.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230222/2906d0e6/attachment.sig>


More information about the U-Boot mailing list