All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH 16/16] s390/char/con3270: use tty_port_tty guard()
Date: Thu, 14 Aug 2025 10:19:48 +0200	[thread overview]
Message-ID: <20250814081948.7684Af9-hca@linux.ibm.com> (raw)
In-Reply-To: <20250814072456.182853-17-jirislaby@kernel.org>

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@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>
> ---
> Cc: linux-s390@vger.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@linux.ibm.com>

      reply	other threads:[~2025-08-14  8:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14  7:24 [PATCH 00/16] tty: use lock, rpm, and free guards Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 01/16] console: introduce console_lock guard()s Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 02/16] tty: introduce tty_port_tty guard() Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 03/16] serial: introduce uart_port_lock() guard()s Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 04/16] serial: 8250: introduce RPM guard()s Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 05/16] tty: tty_port: use guard()s Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 06/16] mxser: use tty_port_tty guard() in mxser_port_isr() Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 07/16] mxser: use guard()s Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 08/16] serial: serial_core: " Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 09/16] serial: 8250: " Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 10/16] serial: 8250_core: use guard() in serial_unlink_irq_chain() Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 11/16] serial: 8250_omap: extract omap_8250_set_termios_atomic() Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 12/16] serial: 8250_omap: use guard()s Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 13/16] serial: 8250_rsa: " Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 14/16] tty/vt: use guard()s in con_font_set/get() and con_{set,get}_unimap() Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 15/16] tty/vt: use guard()s Jiri Slaby (SUSE)
2025-08-14  7:24 ` [PATCH 16/16] s390/char/con3270: use tty_port_tty guard() Jiri Slaby (SUSE)
2025-08-14  8:19   ` Heiko Carstens [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250814081948.7684Af9-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.