mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 22:51:37 +00:00
tty: Replace ASYNC_NORMAL_ACTIVE bit and update atomically
Replace ASYNC_NORMAL_ACTIVE bit in the tty_port::flags field with TTY_PORT_ACTIVE bit in the tty_port::iflags field. Introduce helpers tty_port_set_active() and tty_port_active() to abstract atomic bit ops. Extract state changes from port lock sections, as this usage is broken and confused; the state transitions are protected by the tty lock (which mutually excludes parallel open/close/hangup), and no user tests the active state while holding the port lock. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5604a98e2f
commit
807c8d81f4
11 changed files with 53 additions and 42 deletions
|
@ -571,6 +571,18 @@ static inline void tty_port_set_cts_flow(struct tty_port *port, bool val)
|
|||
clear_bit(TTY_PORT_CTS_FLOW, &port->iflags);
|
||||
}
|
||||
|
||||
static inline bool tty_port_active(struct tty_port *port)
|
||||
{
|
||||
return test_bit(TTY_PORT_ACTIVE, &port->iflags);
|
||||
}
|
||||
|
||||
static inline void tty_port_set_active(struct tty_port *port, bool val)
|
||||
{
|
||||
if (val)
|
||||
set_bit(TTY_PORT_ACTIVE, &port->iflags);
|
||||
else
|
||||
clear_bit(TTY_PORT_ACTIVE, &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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue