[PATCH v2 7/7] vt: Remove old-style con_blank
flat view
WARM1d
From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2026-10-16 09:34:05
Also in:
linux-serial, lkml, sashiko-reviews
Subsystem:
console subsystem, framebuffer console, framebuffer core, framebuffer layer, parisc architecture, the rest, tty layer and serial drivers · Maintainers:
Greg Kroah-Hartman, Helge Deller, Thomas Zimmermann, Simona Vetter, "James E.J. Bottomley", Linus Torvalds, Jiri Slaby
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