[PATCH master 2/3] console: simple: use common ctrl+c implementation
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Sep 1 07:12:56 PDT 2025
The simple console ctrl+c implementation doesn't define ctrlc_handled()
leading to build errors in some configurations.
Just reuse the normal ctrl+c implementation to fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/Makefile | 2 +-
common/console_simple.c | 14 --------------
include/console.h | 8 --------
include/stdio.h | 4 ++++
4 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/common/Makefile b/common/Makefile
index 9f98de72854f..d501a6a2755a 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -33,7 +33,7 @@ obj-$(CONFIG_CMD_LOADS) += s_record.o
obj-$(CONFIG_MEMTEST) += memtest.o
obj-$(CONFIG_COMMAND_SUPPORT) += command.o
obj-$(CONFIG_CONSOLE_FULL) += console.o console_ctrlc.o
-obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
+obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o console_ctrlc.o
obj-y += console_countdown.o
obj-pbl-$(CONFIG_DDR_SPD) += ddr_spd.o
obj-pbl-$(CONFIG_DDR_SPD) += ddr1_dimm_params.o
diff --git a/common/console_simple.c b/common/console_simple.c
index 702087bd23d7..d2feb58ea3e2 100644
--- a/common/console_simple.c
+++ b/common/console_simple.c
@@ -66,20 +66,6 @@ void console_flush(void)
}
EXPORT_SYMBOL(console_flush);
-/* test if ctrl-c was pressed */
-int ctrlc (void)
-{
- int ret = 0;
-#ifdef CONFIG_ARCH_HAS_CTRLC
- ret = arch_ctrlc();
-#else
- if (tstc() && getchar() == 3)
- ret = 1;
-#endif
- return ret;
-}
-EXPORT_SYMBOL(ctrlc);
-
int console_register(struct console_device *newcdev)
{
if (console)
diff --git a/include/console.h b/include/console.h
index 8d3ec33bfac6..590a78110d04 100644
--- a/include/console.h
+++ b/include/console.h
@@ -222,14 +222,6 @@ static inline int barebox_set_loglevel(int loglevel)
}
#endif
-#ifdef CONFIG_CONSOLE_FULL
-void console_ctrlc_allow(void);
-void console_ctrlc_forbid(void);
-#else
-static inline void console_ctrlc_allow(void) { }
-static inline void console_ctrlc_forbid(void) { }
-#endif
-
/**
* clk_get_for_console - get clock, ignoring known unavailable clock controller
* @dev: device for clock "consumer"
diff --git a/include/stdio.h b/include/stdio.h
index 62a0748e8edc..cecb97ea1a26 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -57,6 +57,8 @@ int vprintf(const char *fmt, va_list args);
int ctrlc(void);
int ctrlc_non_interruptible(void);
void ctrlc_handled(void);
+void console_ctrlc_allow(void);
+void console_ctrlc_forbid(void);
#else
static inline int tstc(void)
{
@@ -97,6 +99,8 @@ static inline void ctrlc_handled(void)
{
}
+static inline void console_ctrlc_allow(void) { }
+static inline void console_ctrlc_forbid(void) { }
#endif
const char *size_human_readable(unsigned long long size);
--
2.47.2
More information about the barebox
mailing list