[PATCH] sunxi: fix build when CONFIG_UART0_PORT_F is selected

Icenowy Zheng icenowy at aosc.io
Sun Mar 6 15:29:50 CET 2022


在 2022-03-05星期六的 21:33 +0000,Andre Przywara写道:
> On Sat,  5 Mar 2022 00:06:01 +0800
> Icenowy Zheng <icenowy at 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 <icenowy at 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:

Well I think we finally shouldn't let CONFIG_UART0_PORT_F conflicts
with CONFIG_MMC_SUNXI, because we should be able to at least use
CONFIG_MMC_SUNXI_SLOT_EXTRA when CONFIG_UART0_PORT_F.

In addition, I don't think toolchain GC is smart enough to remove a
reference.

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




More information about the U-Boot mailing list