mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] console: move ARCH_HAS_CTRLC into Kconfig
@ 2023-11-09 12:43 Ahmad Fatoum
  2023-11-14  8:47 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-11-09 12:43 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] console: move ARCH_HAS_CTRLC into Kconfig
  2023-11-09 12:43 [PATCH] console: move ARCH_HAS_CTRLC into Kconfig Ahmad Fatoum
@ 2023-11-14  8:47 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-11-14  8:47 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Nov 09, 2023 at 01:43:26PM +0100, Ahmad Fatoum wrote:
> 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

Applied, thanks

Sascha

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

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-14  8:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 12:43 [PATCH] console: move ARCH_HAS_CTRLC into Kconfig Ahmad Fatoum
2023-11-14  8:47 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox