]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tty: change tty_write_lock()'s ndelay parameter to bool
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Thu, 10 Aug 2023 09:14:39 +0000 (11:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 22:52:51 +0000 (14:52 -0800)
[ Upstream commit af815336556df28f800669c58ab3bdad7d786b98 ]

It's a yes-no parameter, so convert it to bool to be obvious.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20230810091510.13006-6-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 66aad7d8d3ec ("usb: cdc-acm: return correct error code on unsupported break")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/tty.h
drivers/tty/tty_io.c
drivers/tty/tty_ioctl.c

index 72b88aafd536147328cdf1c635093b39591192a1..989986f67263ae83191c584390a063a032cf682a 100644 (file)
@@ -63,7 +63,7 @@ int tty_check_change(struct tty_struct *tty);
 void __stop_tty(struct tty_struct *tty);
 void __start_tty(struct tty_struct *tty);
 void tty_write_unlock(struct tty_struct *tty);
-int tty_write_lock(struct tty_struct *tty, int ndelay);
+int tty_write_lock(struct tty_struct *tty, bool ndelay);
 void tty_vhangup_session(struct tty_struct *tty);
 void tty_open_proc_set_tty(struct file *filp, struct tty_struct *tty);
 int tty_signal_session_leader(struct tty_struct *tty, int exit_session);
index 3d540dff42ef4e53dead9be5e385a7c84b43f854..12f6ef8d0f45b1bec07edb6520e4c322ee45041c 100644 (file)
@@ -956,7 +956,7 @@ void tty_write_unlock(struct tty_struct *tty)
        wake_up_interruptible_poll(&tty->write_wait, EPOLLOUT);
 }
 
-int tty_write_lock(struct tty_struct *tty, int ndelay)
+int tty_write_lock(struct tty_struct *tty, bool ndelay)
 {
        if (!mutex_trylock(&tty->atomic_write_lock)) {
                if (ndelay)
@@ -1173,7 +1173,7 @@ int tty_send_xchar(struct tty_struct *tty, char ch)
                return 0;
        }
 
-       if (tty_write_lock(tty, 0) < 0)
+       if (tty_write_lock(tty, false) < 0)
                return -ERESTARTSYS;
 
        down_read(&tty->termios_rwsem);
@@ -2507,7 +2507,7 @@ static int send_break(struct tty_struct *tty, unsigned int duration)
                retval = tty->ops->break_ctl(tty, duration);
        else {
                /* Do the work ourselves */
-               if (tty_write_lock(tty, 0) < 0)
+               if (tty_write_lock(tty, false) < 0)
                        return -EINTR;
                retval = tty->ops->break_ctl(tty, -1);
                if (retval)
index 1736130f9c39457847aaf0a4b47028d0a45bd561..dac1e25688034f6ed2a9b0a53028969c334530ea 100644 (file)
@@ -427,7 +427,7 @@ retry_write_wait:
                if (retval < 0)
                        return retval;
 
-               if (tty_write_lock(tty, 0) < 0)
+               if (tty_write_lock(tty, false) < 0)
                        goto retry_write_wait;
 
                /* Racing writer? */