tty: vt: make types around consw::con_blank() bool
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Mon, 22 Jan 2024 11:03:49 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Jan 2024 02:08:54 +0000 (18:08 -0800)
Both the mode_switch parameter and the return value (a redraw needed)
are true/false. So switch them to bool, so that users won't return
-Eerrors or anything else.

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-36-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 d86c1d79869078638dd7c8015c778d5a08d89d5f..139049368fdcf86f8174208d950448d340dfee25 100644 (file)
@@ -79,21 +79,21 @@ static void dummycon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
        raw_notifier_call_chain(&dummycon_output_nh, 0, NULL);
 }
 
-static int dummycon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
-                         int mode_switch)
+static bool dummycon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
+                          bool mode_switch)
 {
        /* Redraw, so that we get putc(s) for output done while blanked */
-       return 1;
+       return true;
 }
 #else
 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 int dummycon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
-                         int mode_switch)
+static bool dummycon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
+                          bool mode_switch)
 {
-       return 0;
+       return false;
 }
 #endif
 
index 63e3ce678aabfa3ca26dbcb32fbfa8402823beeb..c0e1f4554a44b08e927e932d7e3ba2005f60ad84 100644 (file)
@@ -451,8 +451,8 @@ static bool mdacon_switch(struct vc_data *c)
        return true;    /* redrawing needed */
 }
 
-static int mdacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
-                       int mode_switch)
+static bool mdacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
+                        bool mode_switch)
 {
        if (mda_type == TYPE_MDA) {
                if (blank) 
@@ -460,14 +460,14 @@ static int mdacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
                                mda_convert_attr(c->vc_video_erase_char),
                                c->vc_screenbuf_size);
                /* Tell console.c that it has to restore the screen itself */
-               return 1;
+               return true;
        } else {
                if (blank)
                        outb_p(0x00, mda_mode_port);    /* disable video */
                else
                        outb_p(MDA_MODE_VIDEO_EN | MDA_MODE_BLINK_EN, 
                                mda_mode_port);
-               return 0;
+               return false;
        }
 }
 
index 38437a53b7f1180d42b51031664c072e694c68a1..dbb31bf87bf1cd449028647f3b2dccc4f088696b 100644 (file)
@@ -476,8 +476,8 @@ static bool newport_switch(struct vc_data *vc)
        return true;
 }
 
-static int newport_blank(struct vc_data *c, enum vesa_blank_mode blank,
-                        int mode_switch)
+static bool newport_blank(struct vc_data *c, enum vesa_blank_mode blank,
+                         bool mode_switch)
 {
        unsigned short treg;
 
@@ -492,7 +492,8 @@ static int newport_blank(struct vc_data *c, enum vesa_blank_mode blank,
                newport_vc2_set(npregs, VC2_IREG_CONTROL,
                                (treg & ~(VC2_CTRL_EDISP)));
        }
-       return 1;
+
+       return true;
 }
 
 static int newport_set_font(int unit, struct console_font *op, unsigned int vpitch)
index e9d5d1f92883504645ae9097cb92e79b10544c3d..cbb9ef438214f68e10da17bc729b1a432bacf051 100644 (file)
@@ -298,19 +298,20 @@ static bool sticon_switch(struct vc_data *conp)
     return true;       /* needs refreshing */
 }
 
-static int sticon_blank(struct vc_data *c, enum vesa_blank_mode blank,
-                       int mode_switch)
+static bool sticon_blank(struct vc_data *c, enum vesa_blank_mode blank,
+                        bool mode_switch)
 {
     if (blank == VESA_NO_BLANKING) {
        if (mode_switch)
            vga_is_gfx = 0;
-       return 1;
+       return true;
     }
     sti_clear(sticon_sti, 0, 0, c->vc_rows, c->vc_cols, BLANK,
              font_data[c->vc_num]);
     if (mode_switch)
        vga_is_gfx = 1;
-    return 1;
+
+    return true;
 }
 
 static u8 sticon_build_attr(struct vc_data *conp, u8 color,
index 84f3682704c7cf9f4dbf3b8ea5dcad4def3e0d70..c9a22118102f3d7093e682d754f4bf603c0886dc 100644 (file)
@@ -797,8 +797,8 @@ static void vga_pal_blank(struct vgastate *state)
        }
 }
 
-static int vgacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
-                       int mode_switch)
+static bool vgacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
+                        bool mode_switch)
 {
        switch (blank) {
        case VESA_NO_BLANKING:          /* Unblank */
index 69be5f2106bc6c88d7302a4d84bdd1882737124c..eee2adf5c682bc97e7710b7d440d923af296e90b 100644 (file)
@@ -2198,8 +2198,8 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info,
        }
 }
 
-static int fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
-                      int mode_switch)
+static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
+                       bool mode_switch)
 {
        struct fb_info *info = fbcon_info_from_console(vc->vc_num);
        struct fbcon_ops *ops = info->fbcon_par;
@@ -2238,7 +2238,7 @@ static int fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
        else
                fbcon_add_cursor_work(info);
 
-       return 0;
+       return false;
 }
 
 static void fbcon_debug_enter(struct vc_data *vc)
index 69040d7c8f9744ce226539354665137df48462e2..6392bcd2fe7cb3c1c235c62d96f3b7e48aabb17e 100644 (file)
@@ -49,6 +49,9 @@ enum vc_intensity;
  *             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_blank:  blank/unblank the console. The target 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.
  * @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)
@@ -70,8 +73,8 @@ struct consw {
                        unsigned int bottom, enum con_scroll dir,
                        unsigned int lines);
        bool    (*con_switch)(struct vc_data *vc);
-       int     (*con_blank)(struct vc_data *vc, enum vesa_blank_mode blank,
-                            int mode_switch);
+       bool    (*con_blank)(struct vc_data *vc, enum vesa_blank_mode blank,
+                            bool mode_switch);
        int     (*con_font_set)(struct vc_data *vc, struct console_font *font,
                        unsigned int vpitch, unsigned int flags);
        int     (*con_font_get)(struct vc_data *vc, struct console_font *font,