Skip to content

Commit 7cd9f5d

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
s390/char/con3270: use tty_port_tty guard()
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>
1 parent e730c37 commit 7cd9f5d

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

drivers/s390/char/con3270.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,6 @@ static void tty3270_resize(struct raw3270_view *view,
970970
char **old_rcl_lines, **new_rcl_lines;
971971
char *old_prompt, *new_prompt;
972972
char *old_input, *new_input;
973-
struct tty_struct *tty;
974-
struct winsize ws;
975973
size_t prompt_sz;
976974
int new_allocated, old_allocated = tp->allocated_lines;
977975

@@ -1023,14 +1021,14 @@ static void tty3270_resize(struct raw3270_view *view,
10231021
kfree(old_prompt);
10241022
tty3270_free_recall(old_rcl_lines);
10251023
tty3270_set_timer(tp, 1);
1026-
/* Informat tty layer about new size */
1027-
tty = tty_port_tty_get(&tp->port);
1028-
if (!tty)
1029-
return;
1030-
ws.ws_row = tty3270_tty_rows(tp);
1031-
ws.ws_col = tp->view.cols;
1032-
tty_do_resize(tty, &ws);
1033-
tty_kref_put(tty);
1024+
/* Inform the tty layer about new size */
1025+
scoped_guard(tty_port_tty, &tp->port) {
1026+
struct winsize ws = {
1027+
.ws_row = tty3270_tty_rows(tp),
1028+
.ws_col = tp->view.cols,
1029+
};
1030+
tty_do_resize(scoped_tty(), &ws);
1031+
}
10341032
return;
10351033
out_screen:
10361034
tty3270_free_screen(screen, new_rows);

0 commit comments

Comments
 (0)