]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/char/con3270: use tty_port_tty guard()
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Thu, 14 Aug 2025 07:24:56 +0000 (09:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Aug 2025 10:46:27 +0000 (12:46 +0200)
Having the new tty_port_tty guard, use it in tty3270_resize(). This
makes the code easier to read. The winsize is now defined in the
scope and initialized immediately, so that it's obvious.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Link: https://lore.kernel.org/r/20250814072456.182853-17-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/s390/char/con3270.c

index b78b86e8f2812bcceb5fe658c5166a43fd0cf5ba..a367f95c7c53634e59df9f7f1afae25eec7ef68f 100644 (file)
@@ -970,8 +970,6 @@ static void tty3270_resize(struct raw3270_view *view,
        char **old_rcl_lines, **new_rcl_lines;
        char *old_prompt, *new_prompt;
        char *old_input, *new_input;
-       struct tty_struct *tty;
-       struct winsize ws;
        size_t prompt_sz;
        int new_allocated, old_allocated = tp->allocated_lines;
 
@@ -1023,14 +1021,14 @@ static void tty3270_resize(struct raw3270_view *view,
        kfree(old_prompt);
        tty3270_free_recall(old_rcl_lines);
        tty3270_set_timer(tp, 1);
-       /* Informat tty layer about new size */
-       tty = tty_port_tty_get(&tp->port);
-       if (!tty)
-               return;
-       ws.ws_row = tty3270_tty_rows(tp);
-       ws.ws_col = tp->view.cols;
-       tty_do_resize(tty, &ws);
-       tty_kref_put(tty);
+       /* Inform the tty layer about new size */
+       scoped_guard(tty_port_tty, &tp->port) {
+               struct winsize ws = {
+                       .ws_row = tty3270_tty_rows(tp),
+                       .ws_col = tp->view.cols,
+               };
+               tty_do_resize(scoped_tty(), &ws);
+       }
        return;
 out_screen:
        tty3270_free_screen(screen, new_rows);