Skip to content

Commit e5d0424

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
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)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 083cfcf commit e5d0424

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

drivers/tty/tty.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,20 @@ enum {
4141
};
4242

4343
/* 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+
};
4649

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)
4852
{
4953
tty->flow_change = val;
5054
}
5155

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)
5358
{
5459
tty->flow_change = val;
5560
smp_mb();

drivers/tty/tty_ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void tty_unthrottle(struct tty_struct *tty)
104104
if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) &&
105105
tty->ops->unthrottle)
106106
tty->ops->unthrottle(tty);
107-
tty->flow_change = 0;
107+
tty->flow_change = TTY_FLOW_NO_CHANGE;
108108
up_write(&tty->termios_rwsem);
109109
}
110110
EXPORT_SYMBOL(tty_unthrottle);

0 commit comments

Comments
 (0)