diff options
author | 2024-01-22 12:03:28 +0100 | |
---|---|---|
committer | 2024-01-27 18:08:53 -0800 | |
commit | 8e6bd49a6132a6b95aa0bb7b705c9ab535396813 (patch) | |
tree | cc981999b7ae6ad500157487926c9f5eb76c709f /drivers/tty/vt | |
parent | use clamp() for counts in csi_?() handlers (diff) | |
download | linux-8e6bd49a6132a6b95aa0bb7b705c9ab535396813.tar.gz linux-8e6bd49a6132a6b95aa0bb7b705c9ab535396813.tar.bz2 linux-8e6bd49a6132a6b95aa0bb7b705c9ab535396813.zip |
don't pass vc->vc_par[0] to csi_?() handlers
Fetch the value directly in the helpers instead.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Tested-by: Helge Deller <deller@gmx.de> # parisc STI console
Link: https://lore.kernel.org/r/20240122110401.7289-15-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r-- | drivers/tty/vt/vt.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 05baf9ca23f2..16ba3a3666ab 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -1542,13 +1542,13 @@ static void csi_J(struct vc_data *vc, enum CSI_J vpar) vc->vc_need_wrap = 0; } -static void csi_K(struct vc_data *vc, int vpar) +static void csi_K(struct vc_data *vc) { unsigned int count; unsigned short *start = (unsigned short *)vc->vc_pos; int offset; - switch (vpar) { + switch (vc->vc_par[0]) { case 0: /* erase from cursor to end of line */ offset = 0; count = vc->vc_cols - vc->state.x; @@ -1571,10 +1571,10 @@ static void csi_K(struct vc_data *vc, int vpar) do_update_region(vc, (unsigned long)(start + offset), count); } -/* erase the following vpar positions */ -static void csi_X(struct vc_data *vc, unsigned int vpar) +/* erase the following count positions */ +static void csi_X(struct vc_data *vc) { /* not vt100? */ - unsigned int count = clamp(vpar, 1, vc->vc_cols - vc->state.x); + unsigned int count = clamp(vc->vc_par[0], 1, vc->vc_cols - vc->state.x); vc_uniscr_clear_line(vc, vc->state.x, count); scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count); @@ -2010,24 +2010,27 @@ static void csi_at(struct vc_data *vc, unsigned int nr) } /* console_lock is held */ -static void csi_L(struct vc_data *vc, unsigned int nr) +static void csi_L(struct vc_data *vc) { - nr = clamp(nr, 1, vc->vc_rows - vc->state.y); + unsigned int nr = clamp(vc->vc_par[0], 1, vc->vc_rows - vc->state.y); + con_scroll(vc, vc->state.y, vc->vc_bottom, SM_DOWN, nr); vc->vc_need_wrap = 0; } /* console_lock is held */ -static void csi_P(struct vc_data *vc, unsigned int nr) +static void csi_P(struct vc_data *vc) { - nr = clamp(nr, 1, vc->vc_cols - vc->state.x); + unsigned int nr = clamp(vc->vc_par[0], 1, vc->vc_cols - vc->state.x); + delete_char(vc, nr); } /* console_lock is held */ -static void csi_M(struct vc_data *vc, unsigned int nr) +static void csi_M(struct vc_data *vc) { - nr = clamp(nr, 1, vc->vc_rows - vc->state.y); + unsigned int nr = clamp(vc->vc_par[0], 1, vc->vc_rows - vc->state.y); + con_scroll(vc, vc->state.y, vc->vc_bottom, SM_UP, nr); vc->vc_need_wrap = 0; } @@ -2430,16 +2433,16 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) csi_J(vc, vc->vc_par[0]); return; case 'K': - csi_K(vc, vc->vc_par[0]); + csi_K(vc); return; case 'L': - csi_L(vc, vc->vc_par[0]); + csi_L(vc); return; case 'M': - csi_M(vc, vc->vc_par[0]); + csi_M(vc); return; case 'P': - csi_P(vc, vc->vc_par[0]); + csi_P(vc); return; case 'c': if (!vc->vc_par[0]) @@ -2480,7 +2483,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) restore_cur(vc); return; case 'X': - csi_X(vc, vc->vc_par[0]); + csi_X(vc); return; case '@': csi_at(vc, vc->vc_par[0]); |