summaryrefslogtreecommitdiffstats
path: root/common/console.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-08-07 06:14:56 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-08-07 06:14:56 +0200
commit8a11a59b379b641423a6ed655aae36ec00404403 (patch)
treea10f059d0bdcf9ba043cef744d605f9260991b18 /common/console.c
parente3ff4dfa41b4e8afc26b69e5c3d8c127f0f37c39 (diff)
parent9183a8c683014f7f6dae004009556c9c0d4d2a15 (diff)
downloadbarebox-8a11a59b379b641423a6ed655aae36ec00404403.tar.gz
Merge branch 'for-next/efi'
Conflicts: .gitignore Makefile drivers/serial/Makefile
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/common/console.c b/common/console.c
index f982366..e5f4267 100644
--- a/common/console.c
+++ b/common/console.c
@@ -162,6 +162,22 @@ static void console_set_stdoutpath(struct console_device *cdev)
free(str);
}
+static int __console_puts(struct console_device *cdev, const char *s)
+{
+ int n = 0;
+
+ while (*s) {
+ if (*s == '\n') {
+ cdev->putc(cdev, '\r');
+ n++;
+ }
+ cdev->putc(cdev, *s);
+ n++;
+ s++;
+ }
+ return n;
+}
+
int console_register(struct console_device *newcdev)
{
struct device_d *dev = &newcdev->class_dev;
@@ -188,6 +204,9 @@ int console_register(struct console_device *newcdev)
NULL, &newcdev->baudrate, "%u", newcdev);
}
+ if (newcdev->putc && !newcdev->puts)
+ newcdev->puts = __console_puts;
+
dev_add_param(dev, "active", console_std_set, NULL, 0);
if (IS_ENABLED(CONFIG_CONSOLE_ACTIVATE_FIRST)) {
@@ -348,9 +367,19 @@ EXPORT_SYMBOL(console_putc);
int console_puts(unsigned int ch, const char *str)
{
+ struct console_device *cdev;
const char *s = str;
int n = 0;
+ if (initialized == CONSOLE_INIT_FULL) {
+ for_each_console(cdev) {
+ if (cdev->f_active & ch) {
+ n = cdev->puts(cdev, str);
+ }
+ }
+ return n;
+ }
+
while (*s) {
if (*s == '\n') {
console_putc(ch, '\r');