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/serial/crisv10.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/serial/crisv10.c')
-rw-r--r-- | drivers/tty/serial/crisv10.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index 546990334815..92c8c628e00e 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c | |||
@@ -3648,8 +3648,8 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
3648 | schedule_timeout_interruptible(info->port.close_delay); | 3648 | schedule_timeout_interruptible(info->port.close_delay); |
3649 | wake_up_interruptible(&info->port.open_wait); | 3649 | wake_up_interruptible(&info->port.open_wait); |
3650 | } | 3650 | } |
3651 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; | ||
3652 | local_irq_restore(flags); | 3651 | local_irq_restore(flags); |
3652 | tty_port_set_active(&info->port, 0); | ||
3653 | 3653 | ||
3654 | /* port closed */ | 3654 | /* port closed */ |
3655 | 3655 | ||
@@ -3732,7 +3732,7 @@ rs_hangup(struct tty_struct *tty) | |||
3732 | shutdown(info); | 3732 | shutdown(info); |
3733 | info->event = 0; | 3733 | info->event = 0; |
3734 | info->port.count = 0; | 3734 | info->port.count = 0; |
3735 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; | 3735 | tty_port_set_active(&info->port, 0); |
3736 | info->port.tty = NULL; | 3736 | info->port.tty = NULL; |
3737 | wake_up_interruptible(&info->port.open_wait); | 3737 | wake_up_interruptible(&info->port.open_wait); |
3738 | } | 3738 | } |
@@ -3756,7 +3756,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3756 | * then make the check up front and then exit. | 3756 | * then make the check up front and then exit. |
3757 | */ | 3757 | */ |
3758 | if ((filp->f_flags & O_NONBLOCK) || tty_io_error(tty)) { | 3758 | if ((filp->f_flags & O_NONBLOCK) || tty_io_error(tty)) { |
3759 | info->port.flags |= ASYNC_NORMAL_ACTIVE; | 3759 | tty_port_set_active(&info->port, 1); |
3760 | return 0; | 3760 | return 0; |
3761 | } | 3761 | } |
3762 | 3762 | ||
@@ -3825,7 +3825,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3825 | #endif | 3825 | #endif |
3826 | if (retval) | 3826 | if (retval) |
3827 | return retval; | 3827 | return retval; |
3828 | info->port.flags |= ASYNC_NORMAL_ACTIVE; | 3828 | tty_port_set_active(&info->port, 1); |
3829 | return 0; | 3829 | return 0; |
3830 | } | 3830 | } |
3831 | 3831 | ||