Given !con_is_visible(vc) is the equivalent of *vc->vc_display_fg != vc
we have:
struct vc_data *old_vc = vc_cons[fg_console].d;
if (old_vc == vc)
return;
*vc->vc_display_fg = vc;
if (*vc->vc_display_fg != old_vc) /* !con_is_visible(old_vc) */
...
Therefore the last if condition is always true.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index ed39d9cb4432..af5186d2c219 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -946,10 +946,8 @@ void redraw_screen(struct vc_data *vc, int is_switch)
*vc->vc_display_fg = vc;
fg_console = vc->vc_num;
hide_cursor(old_vc);
- if (!con_is_visible(old_vc)) {
- save_screen(old_vc);
- set_origin(old_vc);
- }
+ save_screen(old_vc);
+ set_origin(old_vc);
if (tty0dev)
sysfs_notify(&tty0dev->kobj, NULL, "active");
} else {
On Fri, 23 May 2025, Nicolas Pitre wrote:
> Given !con_is_visible(vc) is the equivalent of *vc->vc_display_fg != vc
> we have:
>
> struct vc_data *old_vc = vc_cons[fg_console].d;
> if (old_vc == vc)
> return;
> *vc->vc_display_fg = vc;
> if (*vc->vc_display_fg != old_vc) /* !con_is_visible(old_vc) */
> ...
Please disregard this patch. Obviously the last if substitution should
rather be:
if (*old_vcvc->vc_display_fg != old_vc)
and there is no guarantee that vc->vc_display_fg and
old_vc->vc_display_fg have the same value.
Nicolas
© 2016 - 2025 Red Hat, Inc.