summaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty.h
diff options
context:
space:
mode:
authorJiri Slaby (SUSE) <jirislaby@kernel.org>2023-09-19 10:51:53 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-03 14:31:16 +0200
commite5d0424ac31154e47bfce857ba908bbe861c7a92 (patch)
treee21ee634ce5ef984d509951e60f125642131d8d9 /drivers/tty/tty.h
parenttty: tty_buffer: use bool for 'restart' in tty_buffer_unlock_exclusive() (diff)
downloadlinux-e5d0424ac31154e47bfce857ba908bbe861c7a92.tar.xz
linux-e5d0424ac31154e47bfce857ba908bbe861c7a92.zip
tty: convert THROTTLE constants into enum
And make an explicit constant for zero too. This allows for easier type checking of the parameter. Note: tty_struct::flow_change is kept as int because include/tty.h (tty_struct) doesn't see tty/tty.h (this enum). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20230919085156.1578-13-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty.h')
-rw-r--r--drivers/tty/tty.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h
index 50862f98273e..93cf5ef1e857 100644
--- a/drivers/tty/tty.h
+++ b/drivers/tty/tty.h
@@ -41,15 +41,20 @@ enum {
};
/* Values for tty->flow_change */
-#define TTY_THROTTLE_SAFE 1
-#define TTY_UNTHROTTLE_SAFE 2
+enum tty_flow_change {
+ TTY_FLOW_NO_CHANGE,
+ TTY_THROTTLE_SAFE,
+ TTY_UNTHROTTLE_SAFE,
+};
-static inline void __tty_set_flow_change(struct tty_struct *tty, int val)
+static inline void __tty_set_flow_change(struct tty_struct *tty,
+ enum tty_flow_change val)
{
tty->flow_change = val;
}
-static inline void tty_set_flow_change(struct tty_struct *tty, int val)
+static inline void tty_set_flow_change(struct tty_struct *tty,
+ enum tty_flow_change val)
{
tty->flow_change = val;
smp_mb();