From 2c8fdd7aea1d3c6c380ea5b5080147dc7fe9c38f Mon Sep 17 00:00:00 2001 From: Gregor Herburger Date: Mon, 13 Apr 2026 17:24:53 +0200 Subject: console: add console_flush_stdin() Add a common helper console_flush_stdin() to drain all pending characters from stdin. This consolidates the open-coded while (tstc()) getchar() pattern that appeared in multiple places across the tree. Signed-off-by: Gregor Herburger Reviewed-by: Alexander Sverdlin Reviewed-by: Quentin Schulz Reviewed-by: Simon Glass --- include/console.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/console.h b/include/console.h index 8d0d7bb8a4c..01a04f28f31 100644 --- a/include/console.h +++ b/include/console.h @@ -202,6 +202,11 @@ int console_clear(void); */ int console_remove_by_name(const char *name); +/** + * console_flush_stdin() - drops all pending characters from stdin + */ +void console_flush_stdin(void); + /* * CONSOLE multiplexing. */ -- cgit v1.2.3