diff mbox series

vt: remove redundant condition from redraw_screen()

Message ID n58o097s-s20p-4222-nqo5-2qp26843rs35@onlyvoer.pbz
State New
Headers show
Series vt: remove redundant condition from redraw_screen() | expand

Commit Message

Nicolas Pitre May 23, 2025, 5:13 p.m. UTC
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 mbox series

Patch

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 {