tty: change tty_write_lock()'s ndelay parameter to bool

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>
This commit is contained in:
Jiri Slaby (SUSE) 2023-08-10 11:14:39 +02:00 committed by Greg Kroah-Hartman
parent 1d28dfedd2
commit af81533655
3 changed files with 5 additions and 5 deletions

View File

@ -63,7 +63,7 @@ int tty_check_change(struct tty_struct *tty);
void __stop_tty(struct tty_struct *tty); void __stop_tty(struct tty_struct *tty);
void __start_tty(struct tty_struct *tty); void __start_tty(struct tty_struct *tty);
void tty_write_unlock(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_vhangup_session(struct tty_struct *tty);
void tty_open_proc_set_tty(struct file *filp, 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); int tty_signal_session_leader(struct tty_struct *tty, int exit_session);

View File

@ -946,7 +946,7 @@ void tty_write_unlock(struct tty_struct *tty)
wake_up_interruptible_poll(&tty->write_wait, EPOLLOUT); 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 (!mutex_trylock(&tty->atomic_write_lock)) {
if (ndelay) if (ndelay)
@ -1160,7 +1160,7 @@ int tty_send_xchar(struct tty_struct *tty, char ch)
return 0; return 0;
} }
if (tty_write_lock(tty, 0) < 0) if (tty_write_lock(tty, false) < 0)
return -ERESTARTSYS; return -ERESTARTSYS;
down_read(&tty->termios_rwsem); down_read(&tty->termios_rwsem);
@ -2486,7 +2486,7 @@ static int send_break(struct tty_struct *tty, unsigned int duration)
retval = tty->ops->break_ctl(tty, duration); retval = tty->ops->break_ctl(tty, duration);
else { else {
/* Do the work ourselves */ /* Do the work ourselves */
if (tty_write_lock(tty, 0) < 0) if (tty_write_lock(tty, false) < 0)
return -EINTR; return -EINTR;
retval = tty->ops->break_ctl(tty, -1); retval = tty->ops->break_ctl(tty, -1);
if (retval) if (retval)

View File

@ -507,7 +507,7 @@ retry_write_wait:
if (retval < 0) if (retval < 0)
return retval; return retval;
if (tty_write_lock(tty, 0) < 0) if (tty_write_lock(tty, false) < 0)
goto retry_write_wait; goto retry_write_wait;
/* Racing writer? */ /* Racing writer? */