[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250814081948.7684Af9-hca@linux.ibm.com>
Date: Thu, 14 Aug 2025 10:19:48 +0200
From: Heiko Carstens <hca@...ux.ibm.com>
To: "Jiri Slaby (SUSE)" <jirislaby@...nel.org>
Cc: gregkh@...uxfoundation.org, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org, Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>, linux-s390@...r.kernel.org
Subject: Re: [PATCH 16/16] s390/char/con3270: use tty_port_tty guard()
On Thu, Aug 14, 2025 at 09:24:56AM +0200, Jiri Slaby (SUSE) wrote:
> 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@...nel.org>
> Cc: Heiko Carstens <hca@...ux.ibm.com>
> Cc: Vasily Gorbik <gor@...ux.ibm.com>
> Cc: Alexander Gordeev <agordeev@...ux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@...ux.ibm.com>
> Cc: Sven Schnelle <svens@...ux.ibm.com>
> ---
> Cc: linux-s390@...r.kernel.org
> ---
> drivers/s390/char/con3270.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)
...
> - 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);
> + }
This generates worse code compared to before, since an extra not needed
"if (IS_ERR(...))" check is added implicitly. For this particular code
it doesn't matter.
Just wanted to mention it, since this is not stated anywhere.
In any case:
Acked-by: Heiko Carstens <hca@...ux.ibm.com>
Powered by blists - more mailing lists