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 <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
Thomas Zimmermann 2026-05-27 17:14:03 +02:00 committed by Helge Deller
parent 6f611e5e5f
commit 8ef78cae98
4 changed files with 13 additions and 7 deletions

View 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;

View 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)

View File

@ -422,6 +422,16 @@ int fb_blank(struct fb_info *info, int blank)
}
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;

View 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;