mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] console_simple: fix linking error when ARCH_HAS_CTRLC enabled
@ 2019-10-15 17:10 iu87m888m
  2019-10-18 10:55 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: iu87m888m @ 2019-10-15 17:10 UTC (permalink / raw)
  To: barebox; +Cc: DU HUANPENG

From: DU HUANPENG <u74147@gmail.com>

this error happens in sandbox with simple console, sandbox
has ARCH_HAS_CTRLC enabled by default

$ make sandbox_defconfig
$ make menuconfig
(select CONFIG_SHELL_SIMPLE)
$ make

LD      barebox
common/built-in.o: In function `__pr_memory_display':
/home/du/source/barebox/common/memory_display.c:117: undefined reference to `ctrlc'
common/built-in.o: In function `run_init':
/home/du/source/barebox/common/startup.c:317: undefined reference to `console_ctrlc_allow'
common/built-in.o: In function `parse_stream_outer':
/home/du/source/barebox/common/hush.c:1742: undefined reference to `ctrlc'
common/built-in.o: In function `run_list_real':
/home/du/source/barebox/common/hush.c:895: undefined reference to `ctrlc'
common/built-in.o: In function `run_shell':
/home/du/source/barebox/common/hush.c:1940: undefined reference to `ctrlc_handled'

Signed-off-by: DU HUANPENG <u74147@gmail.com>
---
 common/console_simple.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/common/console_simple.c b/common/console_simple.c
index 010e0b3..6d293b2 100644
--- a/common/console_simple.c
+++ b/common/console_simple.c
@@ -64,16 +64,20 @@ void console_flush(void)
 }
 EXPORT_SYMBOL(console_flush);
 
-#ifndef ARCH_HAS_CTRLC
 void ctrlc_handled(void)
 {
 }
 /* test if ctrl-c was pressed */
 int ctrlc (void)
 {
+	int ret = 0;
+#ifdef ARCH_HAS_CTRLC
+	ret = arch_ctrlc();
+#else
 	if (tstc() && getchar() == 3)
-		return 1;
-	return 0;
+		ret = 1;
+#endif
+	return ret;
 }
 EXPORT_SYMBOL(ctrlc);
 
@@ -85,8 +89,6 @@ void console_ctrlc_forbid(void)
 {
 }
 
-#endif /* ARCH_HAS_CTRC */
-
 int console_register(struct console_device *newcdev)
 {
 	if (console)
-- 
2.7.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2019-10-18 10:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 17:10 [PATCH] console_simple: fix linking error when ARCH_HAS_CTRLC enabled iu87m888m
2019-10-18 10:55 ` Sascha Hauer

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