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: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] console: move ARCH_HAS_CTRLC into Kconfig
Date: Thu,  9 Nov 2023 13:43:26 +0100	[thread overview]
Message-ID: <20231109124326.1499612-1-a.fatoum@pengutronix.de> (raw)

We should do away altogether with <asm/common.h>, so prepare for doing
that in the future by moing the only content it has on sandbox into
Kconfig.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Kconfig                           |  2 +-
 arch/Kconfig                      | 13 +++++++++++++
 arch/sandbox/Kconfig              |  1 +
 arch/sandbox/include/asm/common.h |  2 --
 common/console.c                  |  2 +-
 common/console_simple.c           |  2 +-
 include/stdio.h                   |  4 ++--
 7 files changed, 19 insertions(+), 7 deletions(-)
 create mode 100644 arch/Kconfig

diff --git a/Kconfig b/Kconfig
index 49bd17c89f33..4c076026b0c9 100644
--- a/Kconfig
+++ b/Kconfig
@@ -8,7 +8,7 @@ mainmenu "Barebox/$(ARCH) $(KERNELVERSION) Configuration"
 
 source "scripts/Kconfig.include"
 
-source "arch/$(SRCARCH)/Kconfig"
+source "arch/Kconfig"
 
 source "common/Kconfig"
 source "commands/Kconfig"
diff --git a/arch/Kconfig b/arch/Kconfig
new file mode 100644
index 000000000000..1a9d32370422
--- /dev/null
+++ b/arch/Kconfig
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# General architecture dependent options
+#
+
+#
+# Note: arch/$(SRCARCH)/Kconfig needs to be included first so that it can
+# override the default values in this file.
+#
+source "arch/$(SRCARCH)/Kconfig"
+
+config ARCH_HAS_CTRLC
+	bool
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 88da35a955ee..136a97b1ad30 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -16,6 +16,7 @@ config SANDBOX
 	select ARCH_HAS_STACK_DUMP if ASAN
 	select GENERIC_FIND_NEXT_BIT
 	select ARCH_HAS_SJLJ
+	select ARCH_HAS_CTRLC
 	select HAS_DEBUG_LL
 	default y
 
diff --git a/arch/sandbox/include/asm/common.h b/arch/sandbox/include/asm/common.h
index 66ed2f5e9c52..002dfb52b513 100644
--- a/arch/sandbox/include/asm/common.h
+++ b/arch/sandbox/include/asm/common.h
@@ -3,6 +3,4 @@
 #ifndef ASM_COMMON_H
 #define ASM_COMMON_H
 
-#define ARCH_HAS_CTRLC
-
 #endif /* ASM_COMMON_H */
diff --git a/common/console.c b/common/console.c
index 7e43a9b5fc0e..03b76b122b2b 100644
--- a/common/console.c
+++ b/common/console.c
@@ -625,7 +625,7 @@ int ctrlc(void)
 	if (ctrlc_abort)
 		return 1;
 
-#ifdef ARCH_HAS_CTRLC
+#ifdef CONFIG_ARCH_HAS_CTRLC
 	ret = arch_ctrlc();
 #else
 	if (tstc() && getchar() == 3)
diff --git a/common/console_simple.c b/common/console_simple.c
index afa9a0f186fb..702087bd23d7 100644
--- a/common/console_simple.c
+++ b/common/console_simple.c
@@ -70,7 +70,7 @@ EXPORT_SYMBOL(console_flush);
 int ctrlc (void)
 {
 	int ret = 0;
-#ifdef ARCH_HAS_CTRLC
+#ifdef CONFIG_ARCH_HAS_CTRLC
 	ret = arch_ctrlc();
 #else
 	if (tstc() && getchar() == 3)
diff --git a/include/stdio.h b/include/stdio.h
index 49f3d0cf77b3..b6ded805cc21 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -60,13 +60,13 @@ static inline int vprintf(const char *fmt, va_list args)
 	return 0;
 }
 
-#ifndef ARCH_HAS_CTRLC
+#ifndef CONFIG_ARCH_HAS_CTRLC
 /* test if ctrl-c was pressed */
 static inline int ctrlc (void)
 {
 	return 0;
 }
-#endif /* ARCH_HAS_CTRLC */
+#endif /* CONFIG_ARCH_HAS_CTRLC */
 
 #endif
 
-- 
2.39.2




             reply	other threads:[~2023-11-09 12:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 12:43 Ahmad Fatoum [this message]
2023-11-14  8:47 ` Sascha Hauer

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=20231109124326.1499612-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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