Commit 7c5337c9 authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman

consoles: use if instead of switch-case in consw::con_cursor()

This is only a preparation for the following cleanup patch to make it
easier. Provided CM_ERASE is the only different, use 'if' instead of
'switch+case' in all those.
Signed-off-by: default avatar"Jiri Slaby (SUSE)" <jirislaby@kernel.org>
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-28-jirislaby@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bfd7de49
...@@ -443,24 +443,20 @@ static void newport_cursor(struct vc_data *vc, int mode) ...@@ -443,24 +443,20 @@ static void newport_cursor(struct vc_data *vc, int mode)
unsigned short treg; unsigned short treg;
int xcurs, ycurs; int xcurs, ycurs;
switch (mode) { treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
case CM_ERASE:
treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
newport_vc2_set(npregs, VC2_IREG_CONTROL,
(treg & ~(VC2_CTRL_ECDISP)));
break;
case CM_MOVE: if (mode == CM_ERASE) {
case CM_DRAW:
treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
newport_vc2_set(npregs, VC2_IREG_CONTROL, newport_vc2_set(npregs, VC2_IREG_CONTROL,
(treg | VC2_CTRL_ECDISP)); (treg & ~(VC2_CTRL_ECDISP)));
xcurs = (vc->vc_pos - vc->vc_visible_origin) / 2; return;
ycurs = ((xcurs / vc->vc_cols) << 4) + 31;
xcurs = ((xcurs % vc->vc_cols) << 3) + xcurs_correction;
newport_vc2_set(npregs, VC2_IREG_CURSX, xcurs);
newport_vc2_set(npregs, VC2_IREG_CURSY, ycurs);
} }
newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg | VC2_CTRL_ECDISP));
xcurs = (vc->vc_pos - vc->vc_visible_origin) / 2;
ycurs = ((xcurs / vc->vc_cols) << 4) + 31;
xcurs = ((xcurs % vc->vc_cols) << 3) + xcurs_correction;
newport_vc2_set(npregs, VC2_IREG_CURSX, xcurs);
newport_vc2_set(npregs, VC2_IREG_CURSY, ycurs);
} }
static int newport_switch(struct vc_data *vc) static int newport_switch(struct vc_data *vc)
......
...@@ -95,23 +95,20 @@ static void sticon_cursor(struct vc_data *conp, int mode) ...@@ -95,23 +95,20 @@ static void sticon_cursor(struct vc_data *conp, int mode)
return; return;
car1 = conp->vc_screenbuf[conp->state.x + conp->state.y * conp->vc_cols]; car1 = conp->vc_screenbuf[conp->state.x + conp->state.y * conp->vc_cols];
switch (mode) { if (mode == CM_ERASE) {
case CM_ERASE:
sti_putc(sticon_sti, car1, conp->state.y, conp->state.x, sti_putc(sticon_sti, car1, conp->state.y, conp->state.x,
font_data[conp->vc_num]); font_data[conp->vc_num]);
break; return;
case CM_MOVE: }
case CM_DRAW:
switch (CUR_SIZE(conp->vc_cursor_type)) { switch (CUR_SIZE(conp->vc_cursor_type)) {
case CUR_UNDERLINE: case CUR_UNDERLINE:
case CUR_LOWER_THIRD: case CUR_LOWER_THIRD:
case CUR_LOWER_HALF: case CUR_LOWER_HALF:
case CUR_TWO_THIRDS: case CUR_TWO_THIRDS:
case CUR_BLOCK: case CUR_BLOCK:
sti_putc(sticon_sti, (car1 & 255) + (0 << 8) + (7 << 11), sti_putc(sticon_sti, (car1 & 255) + (0 << 8) + (7 << 11),
conp->state.y, conp->state.x, font_data[conp->vc_num]); conp->state.y, conp->state.x, font_data[conp->vc_num]);
break;
}
break; break;
} }
} }
......
...@@ -514,47 +514,41 @@ static void vgacon_cursor(struct vc_data *c, int mode) ...@@ -514,47 +514,41 @@ static void vgacon_cursor(struct vc_data *c, int mode)
c_height = c->vc_cell_height; c_height = c->vc_cell_height;
switch (mode) { write_vga(14, (c->vc_pos - vga_vram_base) / 2);
case CM_ERASE:
write_vga(14, (c->vc_pos - vga_vram_base) / 2); if (mode == CM_ERASE) {
if (vga_video_type >= VIDEO_TYPE_VGAC) if (vga_video_type >= VIDEO_TYPE_VGAC)
vgacon_set_cursor_size(31, 30); vgacon_set_cursor_size(31, 30);
else else
vgacon_set_cursor_size(31, 31); vgacon_set_cursor_size(31, 31);
break; return;
}
case CM_MOVE: switch (CUR_SIZE(c->vc_cursor_type)) {
case CM_DRAW: case CUR_UNDERLINE:
write_vga(14, (c->vc_pos - vga_vram_base) / 2); vgacon_set_cursor_size(c_height - (c_height < 10 ? 2 : 3),
switch (CUR_SIZE(c->vc_cursor_type)) { c_height - (c_height < 10 ? 1 : 2));
case CUR_UNDERLINE: break;
vgacon_set_cursor_size(c_height - case CUR_TWO_THIRDS:
(c_height < 10 ? 2 : 3), vgacon_set_cursor_size(c_height / 3,
c_height - c_height - (c_height < 10 ? 1 : 2));
(c_height < 10 ? 1 : 2)); break;
break; case CUR_LOWER_THIRD:
case CUR_TWO_THIRDS: vgacon_set_cursor_size(c_height * 2 / 3,
vgacon_set_cursor_size(c_height / 3, c_height - c_height - (c_height < 10 ? 1 : 2));
(c_height < 10 ? 1 : 2)); break;
break; case CUR_LOWER_HALF:
case CUR_LOWER_THIRD: vgacon_set_cursor_size(c_height / 2,
vgacon_set_cursor_size(c_height * 2 / 3, c_height - c_height - (c_height < 10 ? 1 : 2));
(c_height < 10 ? 1 : 2)); break;
break; case CUR_NONE:
case CUR_LOWER_HALF: if (vga_video_type >= VIDEO_TYPE_VGAC)
vgacon_set_cursor_size(c_height / 2, c_height - vgacon_set_cursor_size(31, 30);
(c_height < 10 ? 1 : 2)); else
break; vgacon_set_cursor_size(31, 31);
case CUR_NONE: break;
if (vga_video_type >= VIDEO_TYPE_VGAC) default:
vgacon_set_cursor_size(31, 30); vgacon_set_cursor_size(1, c_height);
else
vgacon_set_cursor_size(31, 31);
break;
default:
vgacon_set_cursor_size(1, c_height);
break;
}
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment