Re: [PATCH 01/33] tty: introduce and use tty_port_tty_vhangup() helper

From: Jiri Slaby
Date: Mon Jun 23 2025 - 03:31:06 EST


On 11. 06. 25, 13:13, Ilpo Järvinen wrote:
On Wed, 11 Jun 2025, Jiri Slaby (SUSE) wrote:

This code (tty_get -> vhangup -> tty_put) is repeated on few places.
Introduce a helper similar to tty_port_tty_hangup() (asynchronous) to
handle even vhangup (synchronous).

And use it on those places.

In fact, reuse the tty_port_tty_hangup()'s code and call tty_vhangup()
depending on a new bool parameter.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@xxxxxxxxxx>
Cc: Karsten Keil <isdn@xxxxxxxxxxxxxx>
Cc: David Lin <dtwlin@xxxxxxxxx>
Cc: Johan Hovold <johan@xxxxxxxxxx>
Cc: Alex Elder <elder@xxxxxxxxxx>
Cc: Oliver Neukum <oneukum@xxxxxxxx>
Cc: Marcel Holtmann <marcel@xxxxxxxxxxxx>
Cc: Johan Hedberg <johan.hedberg@xxxxxxxxx>
Cc: Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx>

Nice cleanup. I'm not sure if it's important enough to be mentioned in
Documentation/driver-api/tty/tty_port.rst .

At minimum I broke tty_port_tty_hangup()'s kernel-doc:
/**
* tty_port_tty_hangup - helper to hang up a tty
* @port: tty port
* @check_clocal: hang only ttys with %CLOCAL unset?
*/
void __tty_port_tty_hangup(struct tty_port *port, bool check_clocal, bool async)


doc says tty_port_tty_hangup(), code says __tty_port_tty_hangup(). Fix coming, incl. vhangup addition.

thanks,
--
js
suse labs