]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tty: vt: make consw::con_switch() return a bool
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Mon, 22 Jan 2024 11:03:44 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:57:37 +0000 (15:57 +0200)
[ Upstream commit 8d5cc8eed738e3202379722295c626cba0849785 ]

The non-zero (true) return value from consw::con_switch() means a redraw
is needed. So make this return type a bool explicitly instead of int.
The latter might imply that -Eerrors are expected. They are not.

And document the hook.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-parisc@vger.kernel.org
Tested-by: Helge Deller <deller@gmx.de> # parisc STI console
Link: https://lore.kernel.org/r/20240122110401.7289-31-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 03bcbbb3995b ("dummycon: Trigger redraw when switching consoles with deferred takeover")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/vt/vt.c
drivers/video/console/dummycon.c
drivers/video/console/mdacon.c
drivers/video/console/newport_con.c
drivers/video/console/sticon.c
drivers/video/console/vgacon.c
drivers/video/fbdev/core/fbcon.c
include/linux/console.h

index 765db5a7d5f52a8cad6e9dd120346bd082e8bf8b..a6e0c803e96ec1cfdf021c8408cf97e7557b64c3 100644 (file)
@@ -1014,7 +1014,7 @@ void redraw_screen(struct vc_data *vc, int is_switch)
        }
 
        if (redraw) {
-               int update;
+               bool update;
                int old_was_color = vc->vc_can_do_color;
 
                set_origin(vc);
index 6918014b02408f51658f8facd5ffd4c1412048c8..d701f2b51f5b1ecae4c5d07f9e717a1d1905148d 100644 (file)
@@ -119,9 +119,9 @@ static bool dummycon_scroll(struct vc_data *vc, unsigned int top,
        return false;
 }
 
-static int dummycon_switch(struct vc_data *vc)
+static bool dummycon_switch(struct vc_data *vc)
 {
-       return 0;
+       return false;
 }
 
 /*
index 1ddbb6cd5b0ca8ec59786e84ef773de12cc8317b..26b41a8f36c870b0fbefc2a254612e90332a7716 100644 (file)
@@ -454,9 +454,9 @@ static void mdacon_clear(struct vc_data *c, unsigned int y, unsigned int x,
        scr_memsetw(dest, eattr, width * 2);
 }
 
-static int mdacon_switch(struct vc_data *c)
+static bool mdacon_switch(struct vc_data *c)
 {
-       return 1;       /* redrawing needed */
+       return true;    /* redrawing needed */
 }
 
 static int mdacon_blank(struct vc_data *c, int blank, int mode_switch)
index 5dac00c825946e0a39e79779bc30ee624493e00a..1ebb18bf10983f7fd01a91f49b5455fedfb7715e 100644 (file)
@@ -462,7 +462,7 @@ static void newport_cursor(struct vc_data *vc, int mode)
        }
 }
 
-static int newport_switch(struct vc_data *vc)
+static bool newport_switch(struct vc_data *vc)
 {
        static int logo_drawn = 0;
 
@@ -476,7 +476,7 @@ static int newport_switch(struct vc_data *vc)
                }
        }
 
-       return 1;
+       return true;
 }
 
 static int newport_blank(struct vc_data *c, int blank, int mode_switch)
index 58e983b18f1f4e4ad9b53740f135583b0e5915f3..6b82194a8ef365f884888cd6da586e315779fd66 100644 (file)
@@ -309,9 +309,9 @@ static void sticon_clear(struct vc_data *conp, unsigned int sy, unsigned int sx,
              conp->vc_video_erase_char, font_data[conp->vc_num]);
 }
 
-static int sticon_switch(struct vc_data *conp)
+static bool sticon_switch(struct vc_data *conp)
 {
-    return 1;  /* needs refreshing */
+    return true;       /* needs refreshing */
 }
 
 static int sticon_blank(struct vc_data *c, int blank, int mode_switch)
index 54d79edbe85e1018b19e2382fd9b6e5e8da5144f..448aede31b94664a38672afd310779b9e9d97ccb 100644 (file)
@@ -616,7 +616,7 @@ static int vgacon_doresize(struct vc_data *c,
        return 0;
 }
 
-static int vgacon_switch(struct vc_data *c)
+static bool vgacon_switch(struct vc_data *c)
 {
        int x = c->vc_cols * VGA_FONTWIDTH;
        int y = c->vc_rows * c->vc_cell_height;
@@ -645,7 +645,7 @@ static int vgacon_switch(struct vc_data *c)
                        vgacon_doresize(c, c->vc_cols, c->vc_rows);
        }
 
-       return 0;               /* Redrawing not needed */
+       return false;           /* Redrawing not needed */
 }
 
 static void vga_set_palette(struct vc_data *vc, const unsigned char *table)
index 2c8d5a90bf94aa60605c82d38d6bc8089080d0c2..0e68fc85ea63a1adc8b6ff4556c92e13ab340844 100644 (file)
@@ -2062,7 +2062,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
        return 0;
 }
 
-static int fbcon_switch(struct vc_data *vc)
+static bool fbcon_switch(struct vc_data *vc)
 {
        struct fb_info *info, *old_info = NULL;
        struct fbcon_ops *ops;
@@ -2185,9 +2185,9 @@ static int fbcon_switch(struct vc_data *vc)
                              vc->vc_origin + vc->vc_size_row * vc->vc_top,
                              vc->vc_size_row * (vc->vc_bottom -
                                                 vc->vc_top) / 2);
-               return 0;
+               return false;
        }
-       return 1;
+       return true;
 }
 
 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info,
index bd7f3a6a64cd0b8e75e15aa5aa6edf3e5cf09357..e2862542a162dc6e93019859bad92e1abdca0f39 100644 (file)
@@ -40,6 +40,8 @@ enum vc_intensity;
  * @con_scroll: move lines from @top to @bottom in direction @dir by @lines.
  *             Return true if no generic handling should be done.
  *             Invoked by csi_M and printing to the console.
+ * @con_switch: notifier about the console switch; it is supposed to return
+ *             true if a redraw is needed.
  * @con_set_palette: sets the palette of the console to @table (optional)
  * @con_scrolldelta: the contents of the console should be scrolled by @lines.
  *                  Invoked by user. (optional)
@@ -58,7 +60,7 @@ struct consw {
        bool    (*con_scroll)(struct vc_data *vc, unsigned int top,
                        unsigned int bottom, enum con_scroll dir,
                        unsigned int lines);
-       int     (*con_switch)(struct vc_data *vc);
+       bool    (*con_switch)(struct vc_data *vc);
        int     (*con_blank)(struct vc_data *vc, int blank, int mode_switch);
        int     (*con_font_set)(struct vc_data *vc, struct console_font *font,
                        unsigned int flags);