vt: use newly defined CUR_* macros
authorJiri Slaby <jslaby@suse.cz>
Mon, 15 Jun 2020 07:48:58 +0000 (09:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:08:33 +0000 (17:08 +0200)
We defined macros for all the magic constants in the previous patch. So
let us use the macro in the code now.

No functional change intended.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-usb@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
Acked-by: Helge Deller <deller@gmx.de>
Link: https://lore.kernel.org/r/20200615074910.19267-26-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/vt.c
drivers/usb/misc/sisusbvga/sisusb_con.c
drivers/video/console/mdacon.c
drivers/video/console/sticon.c
drivers/video/console/vgacon.c
drivers/video/fbdev/core/bitblit.c
drivers/video/fbdev/core/fbcon.c
drivers/video/fbdev/core/fbcon_ccw.c
drivers/video/fbdev/core/fbcon_cw.c
drivers/video/fbdev/core/fbcon_ud.c
drivers/video/fbdev/core/tileblit.c

index af1ef71..2b9fc62 100644 (file)
@@ -866,17 +866,18 @@ static void add_softcursor(struct vc_data *vc)
        int i = scr_readw((u16 *) vc->vc_pos);
        u32 type = vc->vc_cursor_type;
 
-       if (!(type & 0x10))
+       if (!(type & CUR_SW))
                return;
        if (softcursor_original != -1)
                return;
        softcursor_original = i;
-       i |= (type >> 8) & 0xff00;
-       i ^= type & 0xff00;
-       if ((type & 0x20) && (softcursor_original & 0x7000) == (i & 0x7000))
-               i ^= 0x7000;
-       if ((type & 0x40) && (i & 0x700) == ((i & 0x7000) >> 4))
-               i ^= 0x0700;
+       i |= CUR_SET(type);
+       i ^= CUR_CHANGE(type);
+       if ((type & CUR_ALWAYS_BG) &&
+                       (softcursor_original & CUR_BG) == (i & CUR_BG))
+               i ^= CUR_BG;
+       if ((type & CUR_INVERT_FG_BG) && (i & CUR_FG) == ((i & CUR_BG) >> 4))
+               i ^= CUR_FG;
        scr_writew(i, (u16 *)vc->vc_pos);
        if (con_should_update(vc))
                vc->vc_sw->con_putc(vc, i, vc->state.y, vc->state.x);
@@ -910,7 +911,7 @@ static void set_cursor(struct vc_data *vc)
                if (vc_is_sel(vc))
                        clear_selection();
                add_softcursor(vc);
-               if ((vc->vc_cursor_type & 0x0f) != 1)
+               if (CUR_SIZE(vc->vc_cursor_type) != CUR_NONE)
                        vc->vc_sw->con_cursor(vc, CM_DRAW);
        } else
                hide_cursor(vc);
@@ -2322,7 +2323,10 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
                case 'c':
                        if (vc->vc_priv == EPdec) {
                                if (vc->vc_par[0])
-                                       vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16);
+                                       vc->vc_cursor_type =
+                                               CUR_MAKE(vc->vc_par[0],
+                                                        vc->vc_par[1],
+                                                        vc->vc_par[2]);
                                else
                                        vc->vc_cursor_type = cur_default;
                                return;
index 80657c4..1058eab 100644 (file)
@@ -727,7 +727,7 @@ sisusbcon_cursor(struct vc_data *c, int mode)
 
        baseline = c->vc_font.height - (c->vc_font.height < 10 ? 1 : 2);
 
-       switch (c->vc_cursor_type & 0x0f) {
+       switch (CUR_SIZE(c->vc_cursor_type)) {
                case CUR_BLOCK:         from = 1;
                                        to   = c->vc_font.height;
                                        break;
index 00cb624..ef29b32 100644 (file)
@@ -492,7 +492,7 @@ static void mdacon_cursor(struct vc_data *c, int mode)
 
        mda_set_cursor(c->state.y * mda_num_columns * 2 + c->state.x * 2);
 
-       switch (c->vc_cursor_type & 0x0f) {
+       switch (CUR_SIZE(c->vc_cursor_type)) {
 
                case CUR_LOWER_THIRD:   mda_set_cursor_size(10, 13); break;
                case CUR_LOWER_HALF:    mda_set_cursor_size(7,  13); break;
index bbcdfd3..21a5c28 100644 (file)
@@ -139,7 +139,7 @@ static void sticon_cursor(struct vc_data *conp, int mode)
        break;
     case CM_MOVE:
     case CM_DRAW:
-       switch (conp->vc_cursor_type & 0x0f) {
+       switch (CUR_SIZE(conp->vc_cursor_type)) {
        case CUR_UNDERLINE:
        case CUR_LOWER_THIRD:
        case CUR_LOWER_HALF:
index c1c4ce2..f0f3d57 100644 (file)
@@ -728,7 +728,7 @@ static void vgacon_cursor(struct vc_data *c, int mode)
        case CM_MOVE:
        case CM_DRAW:
                write_vga(14, (c->vc_pos - vga_vram_base) / 2);
-               switch (c->vc_cursor_type & 0x0f) {
+               switch (CUR_SIZE(c->vc_cursor_type)) {
                case CUR_UNDERLINE:
                        vgacon_set_cursor_size(c->state.x,
                                               c->vc_font.height -
index 3b002b3..dde8004 100644 (file)
@@ -241,7 +241,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
        unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
        int w = DIV_ROUND_UP(vc->vc_font.width, 8), c;
        int y = real_y(ops->p, vc->state.y);
-       int attribute, use_sw = (vc->vc_cursor_type & 0x10);
+       int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
        int err = 1;
        char *src;
 
index 38d2a00..86fe41b 100644 (file)
@@ -1393,7 +1393,7 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
        if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
                return;
 
-       if (vc->vc_cursor_type & 0x10)
+       if (vc->vc_cursor_type & CUR_SW)
                fbcon_del_cursor_timer(info);
        else
                fbcon_add_cursor_timer(info);
index 5b67bce..b5dd831 100644 (file)
@@ -226,7 +226,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
        unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
        int w = (vc->vc_font.height + 7) >> 3, c;
        int y = real_y(ops->p, vc->state.y);
-       int attribute, use_sw = (vc->vc_cursor_type & 0x10);
+       int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
        int err = 1, dx, dy;
        char *src;
        u32 vyres = GETVYRES(ops->p->scrollmode, info);
index f1aab3a..dbb5dbf 100644 (file)
@@ -209,7 +209,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
        unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
        int w = (vc->vc_font.height + 7) >> 3, c;
        int y = real_y(ops->p, vc->state.y);
-       int attribute, use_sw = (vc->vc_cursor_type & 0x10);
+       int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
        int err = 1, dx, dy;
        char *src;
        u32 vxres = GETVXRES(ops->p->scrollmode, info);
index 81ed6f6..b2c9cdb 100644 (file)
@@ -256,7 +256,7 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
        unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
        int w = (vc->vc_font.width + 7) >> 3, c;
        int y = real_y(ops->p, vc->state.y);
-       int attribute, use_sw = (vc->vc_cursor_type & 0x10);
+       int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
        int err = 1, dx, dy;
        char *src;
        u32 vyres = GETVYRES(ops->p->scrollmode, info);
index ac51425..1dfaff0 100644 (file)
@@ -83,7 +83,7 @@ static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode,
                        int softback_lines, int fg, int bg)
 {
        struct fb_tilecursor cursor;
-       int use_sw = (vc->vc_cursor_type & 0x10);
+       int use_sw = vc->vc_cursor_type & CUR_SW;
 
        cursor.sx = vc->state.x;
        cursor.sy = vc->state.y;