From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/5] console: Set baudrate during registration
Date: Tue, 17 Nov 2015 12:10:49 +0100 [thread overview]
Message-ID: <1447758651-26575-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1447758651-26575-1-git-send-email-s.hauer@pengutronix.de>
This makes sure that the cdev->baudrate field is always consistent with
the hardware state.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/console.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/common/console.c b/common/console.c
index 84d4ea7..4a1d257 100644
--- a/common/console.c
+++ b/common/console.c
@@ -67,12 +67,6 @@ int console_set_active(struct console_device *cdev, unsigned flag)
if (!cdev->putc)
flag &= ~(CONSOLE_STDOUT | CONSOLE_STDERR);
- if (flag && !cdev->f_active) {
- /* The device is being activated, set its baudrate */
- if (cdev->setbrg)
- cdev->setbrg(cdev, cdev->baudrate);
- }
-
if (!flag && cdev->f_active && cdev->flush)
cdev->flush(cdev);
@@ -240,7 +234,7 @@ static int __console_puts(struct console_device *cdev, const char *s)
int console_register(struct console_device *newcdev)
{
struct device_d *dev = &newcdev->class_dev;
- int activate = 0;
+ int activate = 0, ret;
if (initialized == CONSOLE_UNINITIALIZED)
console_init_early();
@@ -258,6 +252,9 @@ int console_register(struct console_device *newcdev)
platform_device_register(dev);
if (newcdev->setbrg) {
+ ret = newcdev->setbrg(newcdev, CONFIG_BAUDRATE);
+ if (ret)
+ return ret;
newcdev->baudrate = CONFIG_BAUDRATE;
dev_add_param_int(dev, "baudrate", console_baudrate_set,
NULL, &newcdev->baudrate_param, "%u", newcdev);
--
2.6.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-11-17 11:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-17 11:10 loadb console cleanups Sascha Hauer
2015-11-17 11:10 ` [PATCH 1/5] loadb: Use local cdev Sascha Hauer
2015-11-17 11:10 ` [PATCH 2/5] loadb: deactivate console before using it for loadb Sascha Hauer
2015-11-17 11:10 ` Sascha Hauer [this message]
2015-11-17 11:10 ` [PATCH 4/5] loadb: Allow to specify device to use Sascha Hauer
2015-11-17 11:10 ` [PATCH 5/5] loads: Use putchar rather than console_putc Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447758651-26575-4-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox