[PATCH v3 4/6] serial: Implement serial_flush() function for console flush() fallback
Tom Rini
trini at konsulko.com
Wed Sep 21 00:29:02 CEST 2022
On Wed, Sep 21, 2022 at 12:18:57AM +0200, Pali Rohár wrote:
> On Tuesday 20 September 2022 17:40:39 Tom Rini wrote:
> > On Mon, Sep 05, 2022 at 11:31:19AM +0200, Pali Rohár wrote:
> >
> > > Like in all other console functions, implement also serial_flush() function
> > > as a fallback int console flush() function.
> > >
> > > Flush support is available only when config option CONSOLE_FLUSH_SUPPORT is
> > > enabled. So when it is disabled then provides just empty static inline
> > > function serial_flush().
> > >
> > > Signed-off-by: Pali Rohár <pali at kernel.org>
> > > Reviewed-by: Simon Glass <sjg at chromium.org>
> >
> > This breaks building on a number of platforms such as ds109 probably due
> > to DM_SERIAL not being enabled.
>
> ds109 is failing on error:
>
> LD u-boot
> arm-linux-gnueabihf-ld.bfd: common/console.o: in function `flush':
> /tmp/u-boot/common/console.c:802: undefined reference to `serial_flush'
> arm-linux-gnueabihf-ld.bfd: common/stdio.o: in function `stdio_serial_flush':
> /tmp/u-boot/common/stdio.c:93: undefined reference to `serial_flush'
> make: *** [Makefile:1782: u-boot] Error 1
>
> And serial_flush() is implemented only in serial-uclass.c (which is
> DM_SERIAL code).
>
> So could you try to add this additional guard (into this 4/6 patch)?
>
> diff --git a/include/serial.h b/include/serial.h
> index f9009d4046e3..fe01bcfadb9b 100644
> --- a/include/serial.h
> +++ b/include/serial.h
> @@ -362,7 +362,7 @@ void serial_setbrg(void);
> void serial_putc(const char ch);
> void serial_putc_raw(const char ch);
> void serial_puts(const char *str);
> -#ifdef CONFIG_CONSOLE_FLUSH_SUPPORT
> +#if defined(CONFIG_CONSOLE_FLUSH_SUPPORT) && CONFIG_IS_ENABLED(DM_SERIAL)
> void serial_flush(void);
> #else
> static inline void serial_flush(void) {}
>
> ds109 with this change compiles fine on my computer.
It should, but that means that CONSOLE_FLUSH_SUPPORT itself should be
depending on DM_SERIAL.
--
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/20220920/30775bff/attachment.sig>
More information about the U-Boot
mailing list