]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fbdev: Wrap user-invoked calls to fb_blank() in helper
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 27 May 2026 15:14:03 +0000 (17:14 +0200)
committerHelge Deller <deller@gmx.de>
Tue, 9 Jun 2026 14:00:10 +0000 (16:00 +0200)
Handle fbcon during blanking in fb_blank_from_user(). First blank the
hardware, then blank fbcon. Same for unblanking. Update all callers and
resolve the duplicated logic.

With the new helper, fbdev's sysfb code no longer maintains fbcon state
by itself.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/core/fb_chrdev.c
drivers/video/fbdev/core/fb_internal.h
drivers/video/fbdev/core/fbmem.c
drivers/video/fbdev/core/fbsysfs.c

index 54f926fb411bd46775fecf9e246aa28765dbb7bc..035e67d2c28ff6dc27d94d6ec7caedbed420fbb7 100644 (file)
@@ -138,9 +138,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
                        return -EINVAL;
                console_lock();
                lock_fb_info(info);
-               ret = fb_blank(info, arg);
-               /* might again call into fb_blank */
-               fbcon_fb_blanked(info, arg);
+               ret = fb_blank_from_user(info, arg);
                unlock_fb_info(info);
                console_unlock();
                break;
index 613832d335fe941df7e80424e612cdc95ceb30d3..62e75bf15b9b83419b79257a8ed0d7b7228a6c42 100644 (file)
@@ -44,6 +44,7 @@ extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
 struct fb_info *get_fb_info(unsigned int idx);
 void put_fb_info(struct fb_info *fb_info);
+int fb_blank_from_user(struct fb_info *info, int blank);
 
 /* fb_procfs.c */
 #if defined(CONFIG_FB_DEVICE)
index d37a1039e22190df454c3b693477c88c1f97f10a..1a6758653b64704dae201973180fda54036fb84f 100644 (file)
@@ -422,6 +422,16 @@ err:
 }
 EXPORT_SYMBOL(fb_blank);
 
+int fb_blank_from_user(struct fb_info *info, int blank)
+{
+       int ret = fb_blank(info, blank);
+
+       /* might again call into fb_blank */
+       fbcon_fb_blanked(info, blank);
+
+       return ret;
+}
+
 static int fb_check_foreignness(struct fb_info *fi)
 {
        const bool foreign_endian = fi->flags & FBINFO_FOREIGN_ENDIAN;
index 5ece236e625208811608198ad2b5e1509410f31e..d9743ef353552025a9a588ac8ce802e224529738 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <linux/console.h>
 #include <linux/fb.h>
-#include <linux/fbcon.h>
 #include <linux/major.h>
 
 #include "fb_internal.h"
@@ -229,9 +228,7 @@ static ssize_t store_blank(struct device *device,
 
        arg = simple_strtoul(buf, &last, 0);
        console_lock();
-       err = fb_blank(fb_info, arg);
-       /* might again call into fb_blank */
-       fbcon_fb_blanked(fb_info, arg);
+       err = fb_blank_from_user(fb_info, arg);
        console_unlock();
        if (err < 0)
                return err;