From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/3] console: Add set_active callback
Date: Wed, 17 Dec 2014 15:12:09 +0100 [thread overview]
Message-ID: <1418825531-29433-1-git-send-email-s.hauer@pengutronix.de> (raw)
The netconsole needs to be able to deny activation when the network
has not been enabled. Add an optional callback to the console for
this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/console.c | 7 +++++++
include/console.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/common/console.c b/common/console.c
index e5f4267..c092621 100644
--- a/common/console.c
+++ b/common/console.c
@@ -64,6 +64,7 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
struct console_device *cdev = to_console_dev(dev);
char active[4];
unsigned int flag = 0, i = 0;
+ int ret;
if (val) {
if (strchr(val, 'i') && cdev->getc) {
@@ -90,6 +91,12 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
cdev->setbrg(cdev, cdev->baudrate);
}
+ if (cdev->set_active) {
+ ret = cdev->set_active(cdev, flag);
+ if (ret)
+ return ret;
+ }
+
active[i] = 0;
cdev->f_active = flag;
diff --git a/include/console.h b/include/console.h
index 97a406d..beafb4d 100644
--- a/include/console.h
+++ b/include/console.h
@@ -44,6 +44,7 @@ struct console_device {
int (*setbrg)(struct console_device *cdev, int baudrate);
void (*flush)(struct console_device *cdev);
int (*set_mode)(struct console_device *cdev, enum console_mode mode);
+ int (*set_active)(struct console_device *cdev, unsigned active);
char *devname;
--
2.1.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2014-12-17 14:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 14:12 Sascha Hauer [this message]
2014-12-17 14:12 ` [PATCH 2/3] netconsole: activate in " Sascha Hauer
2014-12-17 14:12 ` [PATCH 3/3] netconsole: fix Documentation 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=1418825531-29433-1-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