diff options
author | Jiri Slaby (SUSE) <jirislaby@kernel.org> | 2023-09-19 10:51:48 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-03 14:31:15 +0200 |
commit | 5b4f9cf3cc339565be1ecd64d608b6ffdfba7c1e (patch) | |
tree | 1b17141ba639a4c716344cd2cfbaa78c0ec6e0ba /drivers/tty/tty_ioctl.c | |
parent | tty: switch tty_{,un}throttle_safe() to return a bool (diff) | |
download | linux-5b4f9cf3cc339565be1ecd64d608b6ffdfba7c1e.tar.xz linux-5b4f9cf3cc339565be1ecd64d608b6ffdfba7c1e.zip |
tty: invert return values of tty_{,un}throttle_safe()
If tty_{,un}throttle_safe() returned true on success (similar to
*_trylock()), it would make the conditions in callers more obvious. So
perform the switch to these inverted values (and fix the callers).
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20230919085156.1578-8-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_ioctl.c')
-rw-r--r-- | drivers/tty/tty_ioctl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index ba60fcf518e0..fb2f1ac5172f 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -124,16 +124,16 @@ EXPORT_SYMBOL(tty_unthrottle); * conditions when throttling is conditional on factors evaluated prior to * throttling. * - * Returns false if tty is throttled (or was already throttled) + * Returns true if tty is throttled (or was already throttled) */ bool tty_throttle_safe(struct tty_struct *tty) { - bool ret = false; + bool ret = true; mutex_lock(&tty->throttle_mutex); if (!tty_throttled(tty)) { if (tty->flow_change != TTY_THROTTLE_SAFE) - ret = true; + ret = false; else { set_bit(TTY_THROTTLED, &tty->flags); if (tty->ops->throttle) @@ -154,16 +154,16 @@ bool tty_throttle_safe(struct tty_struct *tty) * unthrottle due to race conditions when unthrottling is conditional * on factors evaluated prior to unthrottling. * - * Returns false if tty is unthrottled (or was already unthrottled) + * Returns true if tty is unthrottled (or was already unthrottled) */ bool tty_unthrottle_safe(struct tty_struct *tty) { - bool ret = false; + bool ret = true; mutex_lock(&tty->throttle_mutex); if (tty_throttled(tty)) { if (tty->flow_change != TTY_UNTHROTTLE_SAFE) - ret = true; + ret = false; else { clear_bit(TTY_THROTTLED, &tty->flags); if (tty->ops->unthrottle) |