diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2016-04-09 20:53:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-30 12:26:55 -0400 |
commit | 807c8d81f4ec441241cafa3034c58df721fee869 (patch) | |
tree | 83402ad7f36b135d15d1aa6686ff26aa186b3dec /drivers/tty/synclinkmp.c | |
parent | 5604a98e2f95d6221852960a3363588f40d78e22 (diff) |
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/synclinkmp.c')
-rw-r--r-- | drivers/tty/synclinkmp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c index 7a21491d0c0d..95eddc4d9eb8 100644 --- a/drivers/tty/synclinkmp.c +++ b/drivers/tty/synclinkmp.c | |||
@@ -849,9 +849,9 @@ static void hangup(struct tty_struct *tty) | |||
849 | 849 | ||
850 | spin_lock_irqsave(&info->port.lock, flags); | 850 | spin_lock_irqsave(&info->port.lock, flags); |
851 | info->port.count = 0; | 851 | info->port.count = 0; |
852 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; | ||
853 | info->port.tty = NULL; | 852 | info->port.tty = NULL; |
854 | spin_unlock_irqrestore(&info->port.lock, flags); | 853 | spin_unlock_irqrestore(&info->port.lock, flags); |
854 | tty_port_set_active(&info->port, 1); | ||
855 | mutex_unlock(&info->port.mutex); | 855 | mutex_unlock(&info->port.mutex); |
856 | 856 | ||
857 | wake_up_interruptible(&info->port.open_wait); | 857 | wake_up_interruptible(&info->port.open_wait); |
@@ -3285,7 +3285,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3285 | if (filp->f_flags & O_NONBLOCK || tty_io_error(tty)) { | 3285 | if (filp->f_flags & O_NONBLOCK || tty_io_error(tty)) { |
3286 | /* nonblock mode is set or port is not enabled */ | 3286 | /* nonblock mode is set or port is not enabled */ |
3287 | /* just verify that callout device is not active */ | 3287 | /* just verify that callout device is not active */ |
3288 | port->flags |= ASYNC_NORMAL_ACTIVE; | 3288 | tty_port_set_active(port, 1); |
3289 | return 0; | 3289 | return 0; |
3290 | } | 3290 | } |
3291 | 3291 | ||
@@ -3352,7 +3352,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3352 | __FILE__,__LINE__, tty->driver->name, port->count ); | 3352 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3353 | 3353 | ||
3354 | if (!retval) | 3354 | if (!retval) |
3355 | port->flags |= ASYNC_NORMAL_ACTIVE; | 3355 | tty_port_set_active(port, 1); |
3356 | 3356 | ||
3357 | return retval; | 3357 | return retval; |
3358 | } | 3358 | } |