mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] console: add is_ready callbback support
Date: Wed, 20 Nov 2013 13:39:11 +0100	[thread overview]
Message-ID: <1384951152-2902-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20131120122603.GD7965@ns203013.ovh.net>

Some console such as net console need some parameter to work (IP & Port).
So we can not enable them if not present.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/console.c  | 3 +++
 include/console.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/common/console.c b/common/console.c
index 56bc864..32c5d38 100644
--- a/common/console.c
+++ b/common/console.c
@@ -62,6 +62,9 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
 	char active[4];
 	unsigned int flag = 0, i = 0;
 
+	if (cdev->is_ready && !cdev->is_ready(cdev))
+		return -EIO;
+
 	if (val) {
 		if (strchr(val, 'i') && cdev->getc) {
 			active[i++] = 'i';
diff --git a/include/console.h b/include/console.h
index 550b440..b4caf55 100644
--- a/include/console.h
+++ b/include/console.h
@@ -37,6 +37,7 @@ struct console_device {
 	struct device_d *dev;
 	struct device_d class_dev;
 
+	int (*is_ready)(struct console_device *cdev);
 	int (*tstc)(struct console_device *cdev);
 	void (*putc)(struct console_device *cdev, char c);
 	int  (*getc)(struct console_device *cdev);
-- 
1.8.4.3


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

  reply	other threads:[~2013-11-20 12:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 12:26 [PATCH 0/2] fix net console support Jean-Christophe PLAGNIOL-VILLARD
2013-11-20 12:39 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-11-20 12:39   ` [PATCH 2/2] net: netconsole: add is_ready support Jean-Christophe PLAGNIOL-VILLARD
2013-11-22  7:03   ` [PATCH 1/2] console: add is_ready callbback support 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=1384951152-2902-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --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