aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-04-09 17:53:25 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-30 09:26:55 -0700
commitd41861ca19c9e96f12a4f1ebbc8255d00909a232 (patch)
tree4b09c15500d404b0b375469dd673f0bc8fd05f5f /include/linux/tty.h
parenttty: Replace ASYNC_SUSPENDED bit and update atomically (diff)
downloadlinux-dev-d41861ca19c9e96f12a4f1ebbc8255d00909a232.tar.xz
linux-dev-d41861ca19c9e96f12a4f1ebbc8255d00909a232.zip
tty: Replace ASYNC_INITIALIZED bit and update atomically
Replace ASYNC_INITIALIZED bit in the tty_port::flags field with TTY_PORT_INITIALIZED bit in the tty_port::iflags field. Introduce helpers tty_port_set_initialized() and tty_port_initialized() to abstract atomic bit ops. Note: the transforms for test_and_set_bit() and test_and_clear_bit() are unnecessary as the state transitions are already mutually exclusive; the tty lock prevents concurrent open/close/hangup. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 7ac5add66c00..bf1bcdb01df0 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -610,6 +610,19 @@ static inline void tty_port_set_suspended(struct tty_port *port, bool val)
clear_bit(TTY_PORT_SUSPENDED, &port->iflags);
}
+static inline bool tty_port_initialized(struct tty_port *port)
+{
+ return test_bit(TTY_PORT_INITIALIZED, &port->iflags);
+}
+
+static inline void tty_port_set_initialized(struct tty_port *port, bool val)
+{
+ if (val)
+ set_bit(TTY_PORT_INITIALIZED, &port->iflags);
+ else
+ clear_bit(TTY_PORT_INITIALIZED, &port->iflags);
+}
+
extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
extern int tty_port_carrier_raised(struct tty_port *port);