summaryrefslogtreecommitdiff
path: root/drivers/tty/tty_ioctl.c
diff options
context:
space:
mode:
authorJiri Slaby (SUSE) <jirislaby@kernel.org>2023-09-19 11:51:47 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-03 15:31:15 +0300
commitc2a36609dab3b7c937ab95bfb8b98e72391f772e (patch)
tree40ba25c1bd907bd250dcdc04994bff4e69521f39 /drivers/tty/tty_ioctl.c
parent043c8a7c01ec4b13aa0da11a86425241937b112c (diff)
downloadlinux-c2a36609dab3b7c937ab95bfb8b98e72391f772e.tar.xz
tty: switch tty_{,un}throttle_safe() to return a bool
They return 0 or 1 -- a boolean value, so make it clear than noone should expect negative or other values. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20230919085156.1578-7-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.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 7958bf6d27c4..ba60fcf518e0 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -124,17 +124,16 @@ EXPORT_SYMBOL(tty_unthrottle);
* conditions when throttling is conditional on factors evaluated prior to
* throttling.
*
- * Returns 0 if tty is throttled (or was already throttled)
+ * Returns false if tty is throttled (or was already throttled)
*/
-
-int tty_throttle_safe(struct tty_struct *tty)
+bool tty_throttle_safe(struct tty_struct *tty)
{
- int ret = 0;
+ bool ret = false;
mutex_lock(&tty->throttle_mutex);
if (!tty_throttled(tty)) {
if (tty->flow_change != TTY_THROTTLE_SAFE)
- ret = 1;
+ ret = true;
else {
set_bit(TTY_THROTTLED, &tty->flags);
if (tty->ops->throttle)
@@ -155,17 +154,16 @@ int tty_throttle_safe(struct tty_struct *tty)
* unthrottle due to race conditions when unthrottling is conditional
* on factors evaluated prior to unthrottling.
*
- * Returns 0 if tty is unthrottled (or was already unthrottled)
+ * Returns false if tty is unthrottled (or was already unthrottled)
*/
-
-int tty_unthrottle_safe(struct tty_struct *tty)
+bool tty_unthrottle_safe(struct tty_struct *tty)
{
- int ret = 0;
+ bool ret = false;
mutex_lock(&tty->throttle_mutex);
if (tty_throttled(tty)) {
if (tty->flow_change != TTY_UNTHROTTLE_SAFE)
- ret = 1;
+ ret = true;
else {
clear_bit(TTY_THROTTLED, &tty->flags);
if (tty->ops->unthrottle)