* [PATCH] fb: sync enable device parameter with internal state
@ 2020-11-18 11:14 Ahmad Fatoum
2020-11-23 16:42 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2020-11-18 11:14 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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>
---
drivers/video/fb.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 2d82bc01fa04..113c1419a1c1 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))
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] fb: sync enable device parameter with internal state
2020-11-18 11:14 [PATCH] fb: sync enable device parameter with internal state Ahmad Fatoum
@ 2020-11-23 16:42 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-11-23 16:42 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Wed, Nov 18, 2020 at 12:14:45PM +0100, Ahmad Fatoum wrote:
> 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>
> ---
> drivers/video/fb.c | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/drivers/video/fb.c b/drivers/video/fb.c
> index 2d82bc01fa04..113c1419a1c1 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))
> --
> 2.29.2
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-23 16:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 11:14 [PATCH] fb: sync enable device parameter with internal state Ahmad Fatoum
2020-11-23 16:42 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox