On Sat,  5 Mar 2022 00:06:01 +0800
Icenowy Zheng <icen...@aosc.io> wrote:

Hi Icenowy,

> Currently CONFIG_UART0_PORT_F will forbid the build of sunxi-mmc driver,
> which leads calls to it in board/sunxi/board.c a undefined reference.
> 
> Guard that code in #ifndef to fix build.

That's indeed a problem.

> Signed-off-by: Icenowy Zheng <icen...@aosc.io>
> ---
>  board/sunxi/board.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 82c52b28f8..8a003d8559 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -539,6 +539,7 @@ int board_mmc_init(struct bd_info *bis)
>  {
>       __maybe_unused struct mmc *mmc0, *mmc1;
>  
> +#ifndef CONFIG_UART0_PORT_F

Shouldn't it be "#ifdef CONFIG_MMC_SUNXI" instead, which is the actual
reason for the build fail?
And furthermore, this is just a link failure, and I think we rely on
toolchain garbage collection anyway, so I managed with:

        if (!CONFIG_IS_ENABLED(MMC_SUNXI))
                return 0;

which avoids the nested #ifdef.
Shall we go with this instead?

>       mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
>       mmc0 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
>       if (!mmc0)
> @@ -549,6 +550,7 @@ int board_mmc_init(struct bd_info *bis)
>       mmc1 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
>       if (!mmc1)
>               return -1;
> +#endif
>  #endif
>  
>       return 0;

Reply via email to