mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/5] console: add missing newline conversion for putc_ll
@ 2018-06-19  6:41 Sascha Hauer
  2018-06-19  6:41 ` [PATCH 2/5] console: remove duplicate newline conversion Sascha Hauer
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sascha Hauer @ 2018-06-19  6:41 UTC (permalink / raw)
  To: Barebox List

putc_ll doesn't do newline conversion (and it shouldn't do, as it's
a static inline function for early debugging, adding more code there
is not nice), so add newline conversion to the console code when
it uses putc_ll for printing early messages.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/console.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/console.c b/common/console.c
index ab3d4d397c..c40eba6d55 100644
--- a/common/console.c
+++ b/common/console.c
@@ -513,6 +513,8 @@ void console_putc(unsigned int ch, char c)
 
 	case CONSOLE_INITIALIZED_BUFFER:
 		kfifo_putc(console_output_fifo, c);
+		if (c == '\n')
+			putc_ll('\r');
 		putc_ll(c);
 		return;
 
-- 
2.17.1


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

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

* [PATCH 2/5] console: remove duplicate newline conversion
  2018-06-19  6:41 [PATCH 1/5] console: add missing newline conversion for putc_ll Sascha Hauer
@ 2018-06-19  6:41 ` Sascha Hauer
  2018-06-19  6:41 ` [PATCH 3/5] console_simple: Remove duplicated " Sascha Hauer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2018-06-19  6:41 UTC (permalink / raw)
  To: Barebox List

When the console is not yet fully initialized then console_puts falls
back to print characters using console_putc. console_putc already
does newline conversion, so do not repeat it in console_puts.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/console.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/common/console.c b/common/console.c
index c40eba6d55..cd37d88cc4 100644
--- a/common/console.c
+++ b/common/console.c
@@ -552,10 +552,9 @@ int console_puts(unsigned int ch, const char *str)
 	}
 
 	while (*s) {
-		if (*s == '\n') {
-			console_putc(ch, '\r');
+		if (*s == '\n')
 			n++;
-		}
+
 		console_putc(ch, *s);
 		n++;
 		s++;
-- 
2.17.1


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

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

* [PATCH 3/5] console_simple: Remove duplicated newline conversion
  2018-06-19  6:41 [PATCH 1/5] console: add missing newline conversion for putc_ll Sascha Hauer
  2018-06-19  6:41 ` [PATCH 2/5] console: remove duplicate newline conversion Sascha Hauer
@ 2018-06-19  6:41 ` Sascha Hauer
  2018-06-19  6:41 ` [PATCH 4/5] console_simple: Fix " Sascha Hauer
  2018-06-19  6:41 ` [PATCH 5/5] console_simple: add newline conversion for putc_ll case Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2018-06-19  6:41 UTC (permalink / raw)
  To: Barebox List

console_puts uses console_putc for printing which already does newline
conversion, so do not do it again in console_puts.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/console_simple.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/common/console_simple.c b/common/console_simple.c
index 9675cbb0a6..0825ec07ec 100644
--- a/common/console_simple.c
+++ b/common/console_simple.c
@@ -16,8 +16,6 @@ int console_puts(unsigned int ch, const char *str)
 
 	while (*s) {
 		console_putc(ch, *s);
-		if (*s == '\n')
-			console_putc(ch, '\r');
 		s++;
 		i++;
 	}
-- 
2.17.1


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

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

* [PATCH 4/5] console_simple: Fix newline conversion
  2018-06-19  6:41 [PATCH 1/5] console: add missing newline conversion for putc_ll Sascha Hauer
  2018-06-19  6:41 ` [PATCH 2/5] console: remove duplicate newline conversion Sascha Hauer
  2018-06-19  6:41 ` [PATCH 3/5] console_simple: Remove duplicated " Sascha Hauer
@ 2018-06-19  6:41 ` Sascha Hauer
  2018-06-19  6:41 ` [PATCH 5/5] console_simple: add newline conversion for putc_ll case Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2018-06-19  6:41 UTC (permalink / raw)
  To: Barebox List

Newline should be "\r\n" rather than "\n\r"

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/console_simple.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/console_simple.c b/common/console_simple.c
index 0825ec07ec..ee87b8c52f 100644
--- a/common/console_simple.c
+++ b/common/console_simple.c
@@ -31,9 +31,10 @@ void console_putc(unsigned int ch, char c)
 		return;
 	}
 
-	console->putc(console, c);
 	if (c == '\n')
 		console->putc(console, '\r');
+
+	console->putc(console, c);
 }
 EXPORT_SYMBOL(console_putc);
 
-- 
2.17.1


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

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

* [PATCH 5/5] console_simple: add newline conversion for putc_ll case
  2018-06-19  6:41 [PATCH 1/5] console: add missing newline conversion for putc_ll Sascha Hauer
                   ` (2 preceding siblings ...)
  2018-06-19  6:41 ` [PATCH 4/5] console_simple: Fix " Sascha Hauer
@ 2018-06-19  6:41 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2018-06-19  6:41 UTC (permalink / raw)
  To: Barebox List

When console_putc uses putc_ll for early printing then it must
do a newline conversion as putc_ll doesn't do it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/console_simple.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/console_simple.c b/common/console_simple.c
index ee87b8c52f..385da2fd86 100644
--- a/common/console_simple.c
+++ b/common/console_simple.c
@@ -27,6 +27,8 @@ EXPORT_SYMBOL(console_puts);
 void console_putc(unsigned int ch, char c)
 {
 	if (!console) {
+		if (c == '\n')
+			putc_ll('\r');
 		putc_ll(c);
 		return;
 	}
-- 
2.17.1


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

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

end of thread, other threads:[~2018-06-19  6:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19  6:41 [PATCH 1/5] console: add missing newline conversion for putc_ll Sascha Hauer
2018-06-19  6:41 ` [PATCH 2/5] console: remove duplicate newline conversion Sascha Hauer
2018-06-19  6:41 ` [PATCH 3/5] console_simple: Remove duplicated " Sascha Hauer
2018-06-19  6:41 ` [PATCH 4/5] console_simple: Fix " Sascha Hauer
2018-06-19  6:41 ` [PATCH 5/5] console_simple: add newline conversion for putc_ll case Sascha Hauer

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