summaryrefslogtreecommitdiff
path: root/cmd/conitrace.c
diff options
context:
space:
mode:
authorGregor Herburger <[email protected]>2026-04-13 17:24:53 +0200
committerTom Rini <[email protected]>2026-04-22 14:23:49 -0600
commit2c8fdd7aea1d3c6c380ea5b5080147dc7fe9c38f (patch)
tree266330ba84691d7cbdabeab1f38ba7fd712c2aed /cmd/conitrace.c
parent3abc7c1d46de4211b2d11051033566c9ad2c2740 (diff)
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 <[email protected]> Reviewed-by: Alexander Sverdlin <[email protected]> Reviewed-by: Quentin Schulz <[email protected]> Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'cmd/conitrace.c')
-rw-r--r--cmd/conitrace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/conitrace.c b/cmd/conitrace.c
index 6cc113328eb..aef094e03df 100644
--- a/cmd/conitrace.c
+++ b/cmd/conitrace.c
@@ -6,6 +6,7 @@
* Copyright (c) 2018, Heinrich Schuchardt <[email protected]>
*/
#include <command.h>
+#include <console.h>
#include <linux/delay.h>
static int do_conitrace(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -17,8 +18,7 @@ static int do_conitrace(struct cmd_tbl *cmdtp, int flag, int argc,
printf("To terminate type 'x'\n");
/* Empty input buffer */
- while (tstc())
- getchar();
+ console_flush_stdin();
for (;;) {
int c = getchar();