s390/tty3270: use switch/case in tty3270_erase_line()
authorSven Schnelle <svens@linux.ibm.com>
Tue, 29 Nov 2022 11:11:05 +0000 (12:11 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 9 Jan 2023 13:33:57 +0000 (14:33 +0100)
This makes the code easier to read.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
drivers/s390/char/con3270.c

index 2ccfe14765e6fdc51fe5baf3e38b46fe78b0e9d1..90671dd62cb364a565fd854496ab1418d8f61416 100644 (file)
@@ -1306,9 +1306,11 @@ static void tty3270_erase_line(struct tty3270 *tp, int mode)
        int i;
 
        line = tp->screen + tp->cy;
-       if (mode == 0)
+       switch (mode) {
+       case 0:
                line->len = tp->cx;
-       else if (mode == 1) {
+               break;
+       case 1:
                for (i = 0; i < tp->cx; i++) {
                        cell = line->cells + i;
                        cell->character = ' ';
@@ -1317,8 +1319,13 @@ static void tty3270_erase_line(struct tty3270 *tp, int mode)
                }
                if (line->len <= tp->cx)
                        line->len = tp->cx + 1;
-       } else if (mode == 2)
+               break;
+       case 2:
                line->len = 0;
+               break;
+       default:
+               return;
+       }
        tty3270_convert_line(tp, tp->cy);
 }