don't pass vc->vc_par[0] to csi_?() handlers
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Mon, 22 Jan 2024 11:03:28 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Jan 2024 02:08:53 +0000 (18:08 -0800)
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>
drivers/tty/vt/vt.c

index 05baf9ca23f24ce2f82f97baef6a8eba34be1ec8..16ba3a3666ab8ce37301da7a22a2edc6695ca6b7 100644 (file)
@@ -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]);