[PATCH 11/11] fb: add a usage counter to prevent double enable/disable

Sascha Hauer s.hauer at pengutronix.de
Thu Jun 24 05:39:16 EDT 2010


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/video/fb.c |    5 +++++
 include/fb.h       |    4 +++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 841c3af..f9a425e 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -39,6 +39,9 @@ static int fb_enable_set(struct device_d *dev, struct param_d *param,
 
 	enable = simple_strtoul(val, NULL, 0);
 
+	if (info->enabled == !!enable)
+		return 0;
+
 	if (enable) {
 		info->fbops->fb_enable(info);
 		new = "1";
@@ -49,6 +52,8 @@ static int fb_enable_set(struct device_d *dev, struct param_d *param,
 
 	dev_param_set_generic(dev, param, new);
 
+	info->enabled = !!enable;
+
 	return 0;
 }
 
diff --git a/include/fb.h b/include/fb.h
index 218500b..379f931 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -96,7 +96,9 @@ struct fb_info {
 	struct fb_bitfield red;		/* bitfield in fb mem if true color, */
 	struct fb_bitfield green;	/* else only length is significant */
 	struct fb_bitfield blue;
-	struct fb_bitfield transp;	/* transparency			*/	
+	struct fb_bitfield transp;	/* transparency			*/
+
+	int enabled;
 };
 
 int register_framebuffer(struct fb_info *info);
-- 
1.7.1




More information about the barebox mailing list