]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tty: vt: make init parameter of consw::con_init() a bool
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Mon, 22 Jan 2024 11:03:34 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Jul 2025 09:00:10 +0000 (11:00 +0200)
[ Upstream commit dae3e6b6180f1a2394b984c596d39ed2c57d25fe ]

The 'init' parameter of consw::con_init() is true for the first call of
the hook on a particular console. So make the parameter a bool.

And document the hook.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
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-21-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 6bd1a7785e888c6b397332c93ece47a1212ccc54..83028ccf6e5291f32c7ea2718fc070c92c1a0c8a 100644 (file)
@@ -999,7 +999,7 @@ int vc_cons_allocated(unsigned int i)
        return (i < MAX_NR_CONSOLES && vc_cons[i].d);
 }
 
-static void visual_init(struct vc_data *vc, int num, int init)
+static void visual_init(struct vc_data *vc, int num, bool init)
 {
        /* ++Geert: vc->vc_sw->con_init determines console size */
        if (vc->vc_sw)
@@ -1083,7 +1083,7 @@ int vc_allocate(unsigned int currcons)    /* return 0 on success */
        vc->port.ops = &vc_port_ops;
        INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
 
-       visual_init(vc, currcons, 1);
+       visual_init(vc, currcons, true);
 
        if (!*vc->uni_pagedict_loc)
                con_set_default_unimap(vc);
@@ -3474,7 +3474,7 @@ static int __init con_init(void)
                vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
                INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
                tty_port_init(&vc->port);
-               visual_init(vc, currcons, 1);
+               visual_init(vc, currcons, true);
                /* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */
                vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
                vc_init(vc, currcons || !vc->vc_sw->con_save_screen);
@@ -3642,7 +3642,7 @@ static int do_bind_con_driver(const struct consw *csw, int first, int last,
                old_was_color = vc->vc_can_do_color;
                vc->vc_sw->con_deinit(vc);
                vc->vc_origin = (unsigned long)vc->vc_screenbuf;
-               visual_init(vc, i, 0);
+               visual_init(vc, i, false);
                set_origin(vc);
                update_attr(vc);
 
index f1711b2f9ff057449bccbb923ff4812c5b67a75d..9a19eb72a18b96951f3574472c2b088b3d746fb5 100644 (file)
@@ -97,7 +97,7 @@ static const char *dummycon_startup(void)
     return "dummy device";
 }
 
-static void dummycon_init(struct vc_data *vc, int init)
+static void dummycon_init(struct vc_data *vc, bool init)
 {
     vc->vc_can_do_color = 1;
     if (init) {
index ef29b321967f07353f92714f78a58522e907ddf5..c5b255c9687947b89d360ccabec124e10e65a961 100644 (file)
@@ -352,7 +352,7 @@ static const char *mdacon_startup(void)
        return "MDA-2";
 }
 
-static void mdacon_init(struct vc_data *c, int init)
+static void mdacon_init(struct vc_data *c, bool init)
 {
        c->vc_complement_mask = 0x0800;  /* reverse video */
        c->vc_display_fg = &mda_display_fg;
index e8e4f82cd4a1b845c83f36d126745fffbf176b46..12c64ef470877bb3030d2c7c128e93600db43f22 100644 (file)
@@ -324,7 +324,7 @@ out_unmap:
        return NULL;
 }
 
-static void newport_init(struct vc_data *vc, int init)
+static void newport_init(struct vc_data *vc, bool init)
 {
        int cols, rows;
 
index 992a4fa431aaa90cbf8f47f9d86a51169b3dda38..0bfeabc3f7c72ff4136f8c2d6f221c4bdf5c734f 100644 (file)
@@ -273,7 +273,7 @@ static int sticon_font_set(struct vc_data *vc, struct console_font *font,
        return sticon_set_font(vc, font, vpitch);
 }
 
-static void sticon_init(struct vc_data *c, int init)
+static void sticon_init(struct vc_data *c, bool init)
 {
     struct sti_struct *sti = sticon_sti;
     int vc_cols, vc_rows;
index c9ec89649b055272f985e670607fbaa6f6012475..490e157aebdd41e9bbaef0338e5e62836c4a756d 100644 (file)
@@ -332,7 +332,7 @@ static const char *vgacon_startup(void)
        return display_desc;
 }
 
-static void vgacon_init(struct vc_data *c, int init)
+static void vgacon_init(struct vc_data *c, bool init)
 {
        struct uni_pagedict *p;
 
@@ -349,7 +349,7 @@ static void vgacon_init(struct vc_data *c, int init)
        c->vc_scan_lines = vga_scan_lines;
        c->vc_font.height = c->vc_cell_height = vga_video_font_height;
 
-       /* set dimensions manually if init != 0 since vc_resize() will fail */
+       /* set dimensions manually if init is true since vc_resize() will fail */
        if (init) {
                c->vc_cols = vga_video_num_columns;
                c->vc_rows = vga_video_num_lines;
index 75996ef9992e41819cb58fe59a36fc86166d7a29..9f10a6e92e50964aa26d3cc4d4e4de6454929d3e 100644 (file)
@@ -993,7 +993,7 @@ static const char *fbcon_startup(void)
        return display_desc;
 }
 
-static void fbcon_init(struct vc_data *vc, int init)
+static void fbcon_init(struct vc_data *vc, bool init)
 {
        struct fb_info *info;
        struct fbcon_ops *ops;
index 7de11c763eb35deed528272727bf2f2bf4d18701..4efe76ac56d749120727021e075da6b9fed6d791 100644 (file)
@@ -36,6 +36,8 @@ enum vc_intensity;
 /**
  * struct consw - callbacks for consoles
  *
+ * @con_init:   initialize the console on @vc. @init is true for the very first
+ *             call on this @vc.
  * @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.
@@ -46,7 +48,7 @@ enum vc_intensity;
 struct consw {
        struct module *owner;
        const char *(*con_startup)(void);
-       void    (*con_init)(struct vc_data *vc, int init);
+       void    (*con_init)(struct vc_data *vc, bool init);
        void    (*con_deinit)(struct vc_data *vc);
        void    (*con_clear)(struct vc_data *vc, int sy, int sx, int height,
                        int width);