From: Sascha Hauer <s.hauer@pengutronix.de>
To: Bastian Stender <bst@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/4] console: replace set_active by open/close
Date: Mon, 27 Feb 2017 10:54:53 +0100 [thread overview]
Message-ID: <20170227095453.5tznukther5d3o46@pengutronix.de> (raw)
In-Reply-To: <20170224142501.2679-2-bst@pengutronix.de>
On Fri, Feb 24, 2017 at 03:24:58PM +0100, Bastian Stender wrote:
> Opening and closing consoles should be independent from setting them
> active. This way it is possible to open e.g. a framebuffer console and
> display text on it without showing stdout/stderr.
>
> Signed-off-by: Bastian Stender <bst@pengutronix.de>
> ---
> common/console.c | 19 +++++++++++++++----
> drivers/video/fbconsole.c | 28 ++++++++++++++++++----------
> include/console.h | 3 ++-
> net/netconsole.c | 27 +++++++++++++++++----------
> 4 files changed, 52 insertions(+), 25 deletions(-)
>
> diff --git a/common/console.c b/common/console.c
> index 74ccfcfc3e..43890b3da8 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -71,10 +71,21 @@ int console_set_active(struct console_device *cdev, unsigned flag)
> if (!flag && cdev->f_active && cdev->flush)
> cdev->flush(cdev);
>
> - if (cdev->set_active) {
> - ret = cdev->set_active(cdev, flag);
> - if (ret)
> - return ret;
> + if (flag == cdev->f_active)
> + return 0;
> +
> + if (!flag) {
> + if (cdev->close) {
> + ret = cdev->close(cdev);
> + if (ret)
> + return ret;
> + }
> + } else {
> + if (cdev->open) {
> + ret = cdev->open(cdev);
> + if (ret)
> + return ret;
> + }
> }
instead of calling into cdev->open/close directly here I would prefer
console_open() / console_close() functions which get called here.
In these functions you can call the driver hooks on first open and last
close.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-02-27 9:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 14:24 [PATCH 0/4] Prepare consoles, add fb flush and Solomon SSD1307 OLED controller support Bastian Stender
2017-02-24 14:24 ` [PATCH 1/4] console: replace set_active by open/close Bastian Stender
2017-02-27 9:54 ` Sascha Hauer [this message]
2017-02-27 15:56 ` [PATCH v2] " Bastian Stender
2017-02-28 7:41 ` Sascha Hauer
2017-02-24 14:24 ` [PATCH 2/4] console: expose consoles in devfs Bastian Stender
2017-02-27 9:55 ` Sascha Hauer
2017-02-27 16:01 ` [PATCH v2] " Bastian Stender
2017-02-28 7:50 ` Sascha Hauer
2017-02-24 14:25 ` [PATCH 3/4] fb: introduce flush for virtual framebuffer Bastian Stender
2017-02-24 14:25 ` [PATCH 4/4] video: add support for Solomon SSD1307 OLED controller family Bastian Stender
2017-02-24 16:10 ` Bastian Stender
2017-02-27 10:08 ` Sascha Hauer
2017-02-27 15:45 ` Bastian Stender
2017-02-28 7:57 ` 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=20170227095453.5tznukther5d3o46@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=bst@pengutronix.de \
/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