Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
7cd9f5d6 e730c373

+8 -10
+8 -10
drivers/s390/char/con3270.c
··· 970 970 char **old_rcl_lines, **new_rcl_lines; 971 971 char *old_prompt, *new_prompt; 972 972 char *old_input, *new_input; 973 - struct tty_struct *tty; 974 - struct winsize ws; 975 973 size_t prompt_sz; 976 974 int new_allocated, old_allocated = tp->allocated_lines; 977 975 ··· 1021 1023 kfree(old_prompt); 1022 1024 tty3270_free_recall(old_rcl_lines); 1023 1025 tty3270_set_timer(tp, 1); 1024 - /* Informat tty layer about new size */ 1025 - tty = tty_port_tty_get(&tp->port); 1026 - if (!tty) 1027 - return; 1028 - ws.ws_row = tty3270_tty_rows(tp); 1029 - ws.ws_col = tp->view.cols; 1030 - tty_do_resize(tty, &ws); 1031 - tty_kref_put(tty); 1026 + /* Inform the tty layer about new size */ 1027 + scoped_guard(tty_port_tty, &tp->port) { 1028 + struct winsize ws = { 1029 + .ws_row = tty3270_tty_rows(tp), 1030 + .ws_col = tp->view.cols, 1031 + }; 1032 + tty_do_resize(scoped_tty(), &ws); 1033 + } 1032 1034 return; 1033 1035 out_screen: 1034 1036 tty3270_free_screen(screen, new_rows);