diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2016-04-09 17:53:22 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-30 09:26:55 -0700 |
commit | 807c8d81f4ec441241cafa3034c58df721fee869 (patch) | |
tree | 83402ad7f36b135d15d1aa6686ff26aa186b3dec /drivers/tty/rocket.c | |
parent | 5604a98e2f95d6221852960a3363588f40d78e22 (diff) | |
download | linux-807c8d81f4ec441241cafa3034c58df721fee869.tar.gz linux-807c8d81f4ec441241cafa3034c58df721fee869.tar.bz2 linux-807c8d81f4ec441241cafa3034c58df721fee869.zip |
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>
Diffstat (limited to 'drivers/tty/rocket.c')
-rw-r--r-- | drivers/tty/rocket.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index 0b802cdd70d0..eb8311b20782 100644 --- a/drivers/tty/rocket.c +++ b/drivers/tty/rocket.c @@ -1042,9 +1042,10 @@ static void rp_close(struct tty_struct *tty, struct file *filp) } } spin_lock_irq(&port->lock); - info->port.flags &= ~(ASYNC_INITIALIZED | ASYNC_NORMAL_ACTIVE); + port->flags &= ~ASYNC_INITIALIZED; tty->closing = 0; spin_unlock_irq(&port->lock); + tty_port_set_active(port, 0); mutex_unlock(&port->mutex); tty_port_tty_set(port, NULL); @@ -1624,7 +1625,7 @@ static int rp_write(struct tty_struct *tty, /* Write remaining data into the port's xmit_buf */ while (1) { /* Hung up ? */ - if (!test_bit(ASYNCB_NORMAL_ACTIVE, &info->port.flags)) + if (!tty_port_active(&info->port)) goto end; c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1); c = min(c, XMIT_BUF_SIZE - info->xmit_head); |