[PATCH v3 2/6] console: Implement flush() function

Simon Glass sjg at chromium.org
Wed Sep 7 23:11:04 CEST 2022


Hi Pali,

On Mon, 5 Sept 2022 at 03:31, Pali Rohár <pali at kernel.org> wrote:
>
> On certain places it is required to flush output print buffers to ensure
> that text strings were sent to console or serial devices. For example when
> printing message that U-Boot is going to boot kernel or when U-Boot is
> going to change baudrate of terminal device.
>
> Therefore introduce a new flush() and fflush() functions into console code.
> These functions will call .flush callback of associated stdio_dev device.
>
> As this function may increase U-Boot side, allow to compile U-Boot without
> this function. For this purpose there is a new config CONSOLE_FLUSH_SUPPORT
> which is enabled by default and can be disabled. It is a good idea to have
> this option enabled for all boards which have enough space for it.
>
> When option is disabled when U-Boot defines just empty static inline
> function fflush() to avoid ifdefs in other code.
>
> Signed-off-by: Pali Rohár <pali at kernel.org>
> ---
> Changes in v3:
> * Added macro STDIO_DEV_ASSIGN_FLUSH()
> ---
>  common/Kconfig      |  6 +++++
>  common/console.c    | 61 +++++++++++++++++++++++++++++++++++++++++++++
>  include/_exports.h  |  3 +++
>  include/stdio.h     | 15 +++++++++++
>  include/stdio_dev.h |  7 ++++++
>  5 files changed, 92 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list