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

Tom Rini
2023-02-22T15:07:10Z

[-- Attachment #1: Type: text/plain, Size: 1286 bytes --]

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.

--
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]