summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBastian Stender <bst@pengutronix.de>2017-02-28 15:31:24 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-02-28 15:52:35 +0100
commit123357079882de948f5f42a15c1af21a26130af2 (patch)
treee139b36d21b05e749025ef5c2825cf96b272bbd0 /drivers
parent3cade5ec3a8a0bbf15c8495915961c9d718877be (diff)
downloadbarebox-123357079882de948f5f42a15c1af21a26130af2.tar.gz
barebox-123357079882de948f5f42a15c1af21a26130af2.tar.xz
console: replace set_active by open/close
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/fbconsole.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
index b5e608e1e4..3b5637b2ba 100644
--- a/drivers/video/fbconsole.c
+++ b/drivers/video/fbconsole.c
@@ -413,21 +413,13 @@ static int setup_font(struct fbc_priv *priv)
return 0;
}
-static int fbc_set_active(struct console_device *cdev, unsigned flags)
+static int fbc_open(struct console_device *cdev)
{
struct fbc_priv *priv = container_of(cdev,
struct fbc_priv, cdev);
struct fb_info *fb = priv->fb;
int ret;
- if (priv->active) {
- fb_close(priv->sc);
- priv->active = false;
- }
-
- if (!(flags & (CONSOLE_STDOUT | CONSOLE_STDERR)))
- return 0;
-
ret = setup_font(priv);
if (ret)
return ret;
@@ -448,6 +440,21 @@ static int fbc_set_active(struct console_device *cdev, unsigned flags)
return 0;
}
+static int fbc_close(struct console_device *cdev)
+{
+ struct fbc_priv *priv = container_of(cdev,
+ struct fbc_priv, cdev);
+
+ if (priv->active) {
+ fb_close(priv->sc);
+ priv->active = false;
+
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
static int set_font(struct param_d *p, void *vpriv)
{
struct fbc_priv *priv = vpriv;
@@ -482,7 +489,8 @@ int register_fbconsole(struct fb_info *fb)
cdev->getc = fbc_getc;
cdev->devname = "fbconsole";
cdev->devid = DEVICE_ID_DYNAMIC;
- cdev->set_active = fbc_set_active;
+ cdev->open = fbc_open;
+ cdev->close = fbc_close;
ret = console_register(cdev);
if (ret) {