mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: fpg@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 2/3] console: simple: use common ctrl+c implementation
Date: Mon,  1 Sep 2025 16:12:56 +0200	[thread overview]
Message-ID: <20250901141259.415561-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250901141259.415561-1-a.fatoum@pengutronix.de>

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@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




  reply	other threads:[~2025-09-01 17:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01 14:12 [PATCH master 1/3] console: move full ctrl+c implementation into separate file Ahmad Fatoum
2025-09-01 14:12 ` Ahmad Fatoum [this message]
2025-09-01 14:12 ` [PATCH master 3/3] sandbox: add simpleconsole_defconfig Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250901141259.415561-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=fpg@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox