summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-11-18 12:14:45 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-23 17:42:00 +0100
commit3a1e315c56bf2b742176e7a2ed8aa48c94c8dab0 (patch)
tree5fc5df03f58b02b146858c8609f2ecce8de399aa /drivers/video
parent656a6f0e97770bb8a2a1a76734a87abbbeff7d56 (diff)
downloadbarebox-3a1e315c56bf2b742176e7a2ed8aa48c94c8dab0.tar.gz
barebox-3a1e315c56bf2b742176e7a2ed8aa48c94c8dab0.tar.xz
fb: sync enable device parameter with internal state
So far fb.enable only reflected whether the fb was enabled/disabled via device parameter. Enabling/disabling the fb via ioctl left the parameter untouched. Remedy this. While at it, have setting of fb.enable if the underlying fb_enable/fb_disable fails as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fb.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 2d82bc01fa..113c1419a1 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -119,22 +119,25 @@ int fb_disable(struct fb_info *info)
return 0;
}
+static int fb_enable_get(struct param_d *param, void *priv)
+{
+ struct fb_info *info = priv;
+
+ info->p_enable = info->enabled;
+ return 0;
+}
+
static int fb_enable_set(struct param_d *param, void *priv)
{
struct fb_info *info = priv;
- int enable;
if (!info->mode)
return -EINVAL;
- enable = info->p_enable;
-
- if (enable)
- fb_enable(info);
+ if (info->p_enable)
+ return fb_enable(info);
else
- fb_disable(info);
-
- return 0;
+ return fb_disable(info);
}
static struct fb_videomode *fb_num_to_mode(struct fb_info *info, int num)
@@ -314,7 +317,7 @@ int register_framebuffer(struct fb_info *info)
if (ret)
goto err_free;
- dev_add_param_bool(dev, "enable", fb_enable_set, NULL,
+ dev_add_param_bool(dev, "enable", fb_enable_set, fb_enable_get,
&info->p_enable, info);
if (IS_ENABLED(CONFIG_DRIVER_VIDEO_EDID))