fbdev/core: simplify cursor_state setting in fbcon_ops::cursor()
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Mon, 22 Jan 2024 11:03:42 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Jan 2024 02:08:54 +0000 (18:08 -0800)
There is a switch decicing if cursor should be drawn or not. The whole
switch can be simplified to one line. Do this cleanup as a preparatory
work for the next patch. There, all the CM_* constants are removed.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Tested-by: Helge Deller <deller@gmx.de> # parisc STI console
Link: https://lore.kernel.org/r/20240122110401.7289-29-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/video/fbdev/core/bitblit.c
drivers/video/fbdev/core/fbcon_ccw.c
drivers/video/fbdev/core/fbcon_cw.c
drivers/video/fbdev/core/fbcon_ud.c

index 8587c9da067003f74f50d3234a759bf3f218bf12..daff152f4c2247a8f2aa847e59ac7086f82f40e7 100644 (file)
@@ -348,16 +348,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
                        mask[i++] = msk;
        }
 
-       switch (mode) {
-       case CM_ERASE:
-               ops->cursor_state.enable = 0;
-               break;
-       case CM_DRAW:
-       case CM_MOVE:
-       default:
-               ops->cursor_state.enable = (use_sw) ? 0 : 1;
-               break;
-       }
+       ops->cursor_state.enable = (mode != CM_ERASE) && !use_sw;
 
        cursor.image.data = src;
        cursor.image.fg_color = ops->cursor_state.image.fg_color;
index 2789ace7963427fe80b82c19eb706daa21e316d9..889423d580bc8466d1f3e3b5b4aa7ee79e62c045 100644 (file)
@@ -349,16 +349,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
                kfree(tmp);
        }
 
-       switch (mode) {
-       case CM_ERASE:
-               ops->cursor_state.enable = 0;
-               break;
-       case CM_DRAW:
-       case CM_MOVE:
-       default:
-               ops->cursor_state.enable = (use_sw) ? 0 : 1;
-               break;
-       }
+       ops->cursor_state.enable = (mode != CM_ERASE) && !use_sw;
 
        cursor.image.data = src;
        cursor.image.fg_color = ops->cursor_state.image.fg_color;
index 86a254c1b2b7b6bd039fde6cbc588f009b7ed338..a306ca5802e8cb36ededd3c038dd4816e3fbc7d0 100644 (file)
@@ -332,16 +332,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
                kfree(tmp);
        }
 
-       switch (mode) {
-       case CM_ERASE:
-               ops->cursor_state.enable = 0;
-               break;
-       case CM_DRAW:
-       case CM_MOVE:
-       default:
-               ops->cursor_state.enable = (use_sw) ? 0 : 1;
-               break;
-       }
+       ops->cursor_state.enable = (mode != CM_ERASE) && !use_sw;
 
        cursor.image.data = src;
        cursor.image.fg_color = ops->cursor_state.image.fg_color;
index 23bc045769d088e8f9690c03dc8228d71635daa0..f6fc458b46c7bb7520d1ca9163ac70ebfb9bfa87 100644 (file)
@@ -372,16 +372,7 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
                        mask[i++] = ~msk;
        }
 
-       switch (mode) {
-       case CM_ERASE:
-               ops->cursor_state.enable = 0;
-               break;
-       case CM_DRAW:
-       case CM_MOVE:
-       default:
-               ops->cursor_state.enable = (use_sw) ? 0 : 1;
-               break;
-       }
+       ops->cursor_state.enable = (mode != CM_ERASE) && !use_sw;
 
        cursor.image.data = src;
        cursor.image.fg_color = ops->cursor_state.image.fg_color;