From: Thomas Zimmermann <tzimmermann@suse.de>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org, deller@gmx.de,
James.Bottomley@HansenPartnership.com, simona@ffwll.ch
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
linux-fbdev@vger.kernel.org, linux-parisc@vger.kernel.org,
sashiko-reviews@lists.linux.dev,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 7/7] vt: Remove old-style con_blank
Date: Fri, 16 Oct 2026 11:11:57 +0200 [thread overview]
Message-ID: <20261016093357.33294-8-tzimmermann@suse.de> (raw)
In-Reply-To: <20261016093357.33294-1-tzimmermann@suse.de>
All consoles implement the new con_blank plus con_unblank. Remove
the old semantics from con_blank. Always pass a VESA blank mode to
the blank parameter. Remove the mode_switch parameter. For unblanking
call con_unblank unconditionally.
Most consoles handle switches from text to graphics mode in their
con_blank callback. With the mode_switch parameter removed, detect
mode switches from console state plus vc_mode. A later change might
add a callback for switching modes to struct consw.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/tty/vt/vt.c | 29 ++++++-----------------------
drivers/video/console/dummycon.c | 6 ++----
drivers/video/console/newport_con.c | 3 +--
drivers/video/console/sticon.c | 5 +++--
drivers/video/console/vgacon.c | 7 ++++---
drivers/video/fbdev/core/fbcon.c | 4 ++--
include/linux/console.h | 7 +++----
7 files changed, 21 insertions(+), 40 deletions(-)
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 04e28166b78d..13914b582cef 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4671,10 +4671,7 @@ void do_blank_screen(int entering_gfx)
if (console_blanked) {
if (blank_state == blank_vesa_wait) {
blank_state = blank_off;
- if (vc->vc_sw->con_unblank)
- vc->vc_sw->con_blank(vc, vesa_blank_mode, 0);
- else
- vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0);
+ vc->vc_sw->con_blank(vc, vesa_blank_mode);
}
return;
}
@@ -4683,10 +4680,7 @@ void do_blank_screen(int entering_gfx)
if (entering_gfx) {
hide_cursor(vc);
save_screen(vc);
- if (vc->vc_sw->con_unblank)
- vc->vc_sw->con_blank(vc, VESA_NO_BLANKING, 1);
- else
- vc->vc_sw->con_blank(vc, VESA_VSYNC_SUSPEND, 1);
+ vc->vc_sw->con_blank(vc, VESA_NO_BLANKING);
console_blanked = fg_console + 1;
blank_state = blank_off;
set_origin(vc);
@@ -4707,12 +4701,7 @@ void do_blank_screen(int entering_gfx)
save_screen(vc);
/* In case we need to reset origin, blanking hook returns 1 */
- if (vc->vc_sw->con_unblank)
- i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_NO_BLANKING :
- vesa_blank_mode, 0);
- else
- i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_VSYNC_SUSPEND :
- (vesa_blank_mode + 1), 0);
+ i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_NO_BLANKING : vesa_blank_mode);
console_blanked = fg_console + 1;
if (i)
set_origin(vc);
@@ -4763,15 +4752,9 @@ void do_unblank_screen(int leaving_gfx)
}
console_blanked = 0;
- if (vc->vc_sw->con_unblank) {
- if (vc->vc_sw->con_unblank(vc))
- /* Low-level driver cannot restore -> do it ourselves */
- update_screen(vc);
- } else {
- if (vc->vc_sw->con_blank(vc, VESA_NO_BLANKING, leaving_gfx))
- /* Low-level driver cannot restore -> do it ourselves */
- update_screen(vc);
- }
+ if (vc->vc_sw->con_unblank(vc))
+ /* Low-level driver cannot restore -> do it ourselves */
+ update_screen(vc);
if (console_blank_hook)
console_blank_hook(0);
set_palette(vc);
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
index ea34a7e84472..a206a3de9f4d 100644
--- a/drivers/video/console/dummycon.c
+++ b/drivers/video/console/dummycon.c
@@ -79,8 +79,7 @@ static void dummycon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
raw_notifier_call_chain(&dummycon_output_nh, 0, NULL);
}
-static bool dummycon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
- bool mode_switch)
+static bool dummycon_blank(struct vc_data *vc, enum vesa_blank_mode blank)
{
/* Redraw, so that we get putc(s) for output done while blanked */
return true;
@@ -104,8 +103,7 @@ static void dummycon_putc(struct vc_data *vc, u16 c, unsigned int y,
unsigned int x) { }
static void dummycon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
unsigned int ypos, unsigned int xpos) { }
-static bool dummycon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
- bool mode_switch)
+static bool dummycon_blank(struct vc_data *vc, enum vesa_blank_mode blank)
{
return false;
}
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index c617a9a27e4c..5b2d927fccbc 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -476,8 +476,7 @@ static bool newport_switch(struct vc_data *vc)
return true;
}
-static bool newport_blank(struct vc_data *c, enum vesa_blank_mode blank,
- bool mode_switch)
+static bool newport_blank(struct vc_data *c, enum vesa_blank_mode blank)
{
unsigned short treg;
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index 0d882ea6b37f..fb0a8aa4c2bc 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -299,9 +299,10 @@ static bool sticon_switch(struct vc_data *conp)
return true; /* needs refreshing */
}
-static bool sticon_blank(struct vc_data *c, enum vesa_blank_mode blank,
- bool mode_switch)
+static bool sticon_blank(struct vc_data *c, enum vesa_blank_mode blank)
{
+ bool mode_switch = !vga_is_gfx && c->vc_mode == KD_GRAPHICS;
+
sti_clear(sticon_sti, 0, 0, c->vc_rows, c->vc_cols, BLANK, font_data[c->vc_num]);
if (mode_switch)
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 7f52164c30af..6463fb7676c5 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -797,15 +797,16 @@ static void vga_pal_blank(struct vgastate *state)
}
}
-static bool vgacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
- bool mode_switch)
+static bool vgacon_blank(struct vc_data *c, enum vesa_blank_mode blank)
{
+ bool mode_switch = !vga_is_gfx && c->vc_mode == KD_GRAPHICS;
+
if (mode_switch)
vga_is_gfx = true;
switch (blank) {
case VESA_NO_BLANKING: /* Normal blanking */
- if (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) {
+ if (c->vc_mode == KD_TEXT && vga_video_type == VIDEO_TYPE_VGAC) {
vga_pal_blank(&vgastate);
vga_palette_blanked = true;
return false;
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 6d564111ebd0..c9a8fb49c06b 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2287,11 +2287,11 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info,
}
}
-static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
- bool mode_switch)
+static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank)
{
struct fb_info *info = fbcon_info_from_console(vc->vc_num);
struct fbcon_par *par = info->fbcon_par;
+ bool mode_switch = !par->graphics && vc->vc_mode == KD_GRAPHICS;
if (mode_switch)
par->graphics = true;
diff --git a/include/linux/console.h b/include/linux/console.h
index aadcb6053cb0..b59b6ac0c01e 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -56,8 +56,8 @@ enum vc_intensity;
* @con_switch: notifier about the console switch; it is supposed to return
* true if a redraw is needed.
* @con_blank: blank the console. The preferred VESA blank mode is passed in
- * @blank. @mode_switch is set if changing from/to text/graphics.
- * The hook is supposed to return true if a redraw is needed.
+ * @blank. The hook is supposed to return true if a redraw is
+ * needed.
* @con_unblank: unblank the console. The hook is supposed to return true if
* a redraw is needed.
* @con_font_set: set console @vc font to @font with height @vpitch. @flags can
@@ -99,8 +99,7 @@ struct consw {
unsigned int bottom, enum con_scroll dir,
unsigned int lines);
bool (*con_switch)(struct vc_data *vc);
- bool (*con_blank)(struct vc_data *vc, enum vesa_blank_mode blank,
- bool mode_switch);
+ bool (*con_blank)(struct vc_data *vc, enum vesa_blank_mode blank);
bool (*con_unblank)(struct vc_data *vc);
int (*con_font_set)(struct vc_data *vc,
const struct console_font *font,
--
2.55.0
next prev parent reply other threads:[~2026-10-16 9:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 9:11 [PATCH v2 0/7] vt: Simplify console-blanking interface Thomas Zimmermann
2026-10-16 9:11 ` [PATCH v2 1/7] vt: Add con_unblank callback to struct consw Thomas Zimmermann
2026-10-16 9:44 ` sashiko-bot
2026-10-16 9:11 ` [PATCH v2 2/7] dummycon: Implement struct consw.con_unblank Thomas Zimmermann
2026-10-16 9:46 ` sashiko-bot
2026-10-16 9:11 ` [PATCH v2 3/7] fbcon: " Thomas Zimmermann
2026-10-16 10:01 ` sashiko-bot
2026-10-16 9:11 ` [PATCH v2 4/7] newport_con: " Thomas Zimmermann
2026-10-16 10:07 ` sashiko-bot
2026-10-16 9:11 ` [PATCH v2 5/7] sticon: " Thomas Zimmermann
2026-10-16 10:13 ` sashiko-bot
2026-10-16 9:11 ` [PATCH v2 6/7] vgacon: " Thomas Zimmermann
2026-10-16 10:26 ` sashiko-bot
2026-10-16 9:11 ` Thomas Zimmermann [this message]
2026-10-16 10:38 ` [PATCH v2 7/7] vt: Remove old-style con_blank sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261016093357.33294-8-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=deller@gmx.de \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.