Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
e5d0424a 083cfcf3

+10 -5
+9 -4
drivers/tty/tty.h
··· 41 41 }; 42 42 43 43 /* Values for tty->flow_change */ 44 - #define TTY_THROTTLE_SAFE 1 45 - #define TTY_UNTHROTTLE_SAFE 2 44 + enum tty_flow_change { 45 + TTY_FLOW_NO_CHANGE, 46 + TTY_THROTTLE_SAFE, 47 + TTY_UNTHROTTLE_SAFE, 48 + }; 46 49 47 - static inline void __tty_set_flow_change(struct tty_struct *tty, int val) 50 + static inline void __tty_set_flow_change(struct tty_struct *tty, 51 + enum tty_flow_change val) 48 52 { 49 53 tty->flow_change = val; 50 54 } 51 55 52 - static inline void tty_set_flow_change(struct tty_struct *tty, int val) 56 + static inline void tty_set_flow_change(struct tty_struct *tty, 57 + enum tty_flow_change val) 53 58 { 54 59 tty->flow_change = val; 55 60 smp_mb();
+1 -1
drivers/tty/tty_ioctl.c
··· 104 104 if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) && 105 105 tty->ops->unthrottle) 106 106 tty->ops->unthrottle(tty); 107 - tty->flow_change = 0; 107 + tty->flow_change = TTY_FLOW_NO_CHANGE; 108 108 up_write(&tty->termios_rwsem); 109 109 } 110 110 EXPORT_SYMBOL(tty_unthrottle);