From: Thomas Zimmermann Date: Wed, 27 May 2026 15:14:03 +0000 (+0200) Subject: fbdev: Wrap user-invoked calls to fb_blank() in helper X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=8ef78cae98b5bb6a627f50339d2a2e85198ad7d3;p=thirdparty%2Flinux.git fbdev: Wrap user-invoked calls to fb_blank() in helper 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 Signed-off-by: Helge Deller --- diff --git a/drivers/video/fbdev/core/fb_chrdev.c b/drivers/video/fbdev/core/fb_chrdev.c index 54f926fb411bd..035e67d2c28ff 100644 --- a/drivers/video/fbdev/core/fb_chrdev.c +++ b/drivers/video/fbdev/core/fb_chrdev.c @@ -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; diff --git a/drivers/video/fbdev/core/fb_internal.h b/drivers/video/fbdev/core/fb_internal.h index 613832d335fe9..62e75bf15b9b8 100644 --- a/drivers/video/fbdev/core/fb_internal.h +++ b/drivers/video/fbdev/core/fb_internal.h @@ -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) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index d37a1039e2219..1a6758653b647 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -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; diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 5ece236e62520..d9743ef353552 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -7,7 +7,6 @@ #include #include -#include #include #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;