summaryrefslogtreecommitdiff
path: root/drivers/tty/tty_buffer.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-06-15 17:36:13 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-24 03:47:09 +0400
commit0f56bd2f6a97d8b0eb5c8f9bc04b83a6c16d1d48 (patch)
tree70337a7fd95f71d5f39aa9d168c09be2ff3465a1 /drivers/tty/tty_buffer.c
parent8c1fb49ba107c7db9441ef6ec0ab5830d112cc2a (diff)
downloadlinux-0f56bd2f6a97d8b0eb5c8f9bc04b83a6c16d1d48.tar.xz
tty: Use non-atomic state to signal flip buffer flush pending
Atomic bit ops are no longer required to indicate a flip buffer flush is pending, as the flush_mutex is sufficient barrier. Remove the unnecessary port .iflags field and localize flip buffer state to struct tty_bufhead. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_buffer.c')
-rw-r--r--drivers/tty/tty_buffer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 39cae611fe59..fb042b9a8d68 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -189,11 +189,11 @@ void tty_buffer_flush(struct tty_struct *tty)
struct tty_port *port = tty->port;
struct tty_bufhead *buf = &port->buf;
- set_bit(TTYP_FLUSHPENDING, &port->iflags);
+ buf->flushpending = 1;
mutex_lock(&buf->flush_mutex);
__tty_buffer_flush(port);
- clear_bit(TTYP_FLUSHPENDING, &port->iflags);
+ buf->flushpending = 0;
mutex_unlock(&buf->flush_mutex);
}
@@ -426,7 +426,7 @@ static void flush_to_ldisc(struct work_struct *work)
int count;
/* Ldisc or user is trying to flush the buffers. */
- if (test_bit(TTYP_FLUSHPENDING, &port->iflags))
+ if (buf->flushpending)
break;
count = head->commit - head->read;
@@ -505,6 +505,7 @@ void tty_buffer_init(struct tty_port *port)
buf->tail = &buf->sentinel;
init_llist_head(&buf->free);
atomic_set(&buf->memory_used, 0);
+ buf->flushpending = 0;
INIT_WORK(&buf->work, flush_to_ldisc);
}