summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-07-09 08:21:05 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-07-09 08:21:05 +0200
commit5086fddc75abe24b987fcf088c67f8b7b40ab3a7 (patch)
treee29e7e1c97518be2836334a34db44d317c4cd69a /common
parent0e8bd85d9b2f981ad24847badda70c73397d8385 (diff)
parent1cbb66f319a8cbdab531a8b38d7474693ef45f13 (diff)
downloadbarebox-5086fddc75abe24b987fcf088c67f8b7b40ab3a7.tar.gz
barebox-5086fddc75abe24b987fcf088c67f8b7b40ab3a7.tar.xz
Merge branch 'for-next/console'
Diffstat (limited to 'common')
-rw-r--r--common/console.c7
-rw-r--r--common/console_common.c3
-rw-r--r--common/console_simple.c7
3 files changed, 10 insertions, 7 deletions
diff --git a/common/console.c b/common/console.c
index ab3d4d397c..cd37d88cc4 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;
@@ -550,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++;
diff --git a/common/console_common.c b/common/console_common.c
index 00e020bd35..0131a1190a 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -301,12 +301,13 @@ EXPORT_SYMBOL(console_get_by_name);
struct console_device *console_get_first_active(void)
{
struct console_device *cdev;
+ const unsigned char active = CONSOLE_STDIN | CONSOLE_STDOUT;
/*
* Assumption to have BOTH CONSOLE_STDIN AND STDOUT in the
* same output console
*/
for_each_console(cdev) {
- if ((cdev->f_active & (CONSOLE_STDIN | CONSOLE_STDOUT)))
+ if ((cdev->f_active & active) == active)
return cdev;
}
diff --git a/common/console_simple.c b/common/console_simple.c
index 9675cbb0a6..385da2fd86 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++;
}
@@ -29,13 +27,16 @@ EXPORT_SYMBOL(console_puts);
void console_putc(unsigned int ch, char c)
{
if (!console) {
+ if (c == '\n')
+ putc_ll('\r');
putc_ll(c);
return;
}
- console->putc(console, c);
if (c == '\n')
console->putc(console, '\r');
+
+ console->putc(console, c);
}
EXPORT_SYMBOL(console_putc);