aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_buffer.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-06-15 09:36:14 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-23 19:47:09 -0400
commit47aa658a015440906def231f54685c4d5d49dc38 (patch)
tree536fc761c482c14a485b60440f3eced177c16d1d /drivers/tty/tty_buffer.c
parent0f56bd2f6a97d8b0eb5c8f9bc04b83a6c16d1d48 (diff)
tty: Merge __tty_flush_buffer() into lone call site
__tty_flush_buffer() is now only called by tty_flush_buffer(); merge functions. 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.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index fb042b9a8d68..dbe4a718e2dc 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -151,28 +151,6 @@ static void tty_buffer_free(struct tty_port *port, struct tty_buffer *b)
151} 151}
152 152
153/** 153/**
154 * __tty_buffer_flush - flush full tty buffers
155 * @tty: tty to flush
156 *
157 * flush all the buffers containing receive data. Caller must
158 * hold the buffer lock and must have ensured no parallel flush to
159 * ldisc is running.
160 */
161
162static void __tty_buffer_flush(struct tty_port *port)
163{
164 struct tty_bufhead *buf = &port->buf;
165 struct tty_buffer *next;
166
167 while ((next = buf->head->next) != NULL) {
168 tty_buffer_free(port, buf->head);
169 buf->head = next;
170 }
171 WARN_ON(buf->head != buf->tail);
172 buf->head->read = buf->head->commit;
173}
174
175/**
176 * tty_buffer_flush - flush full tty buffers 154 * tty_buffer_flush - flush full tty buffers
177 * @tty: tty to flush 155 * @tty: tty to flush
178 * 156 *
@@ -188,11 +166,16 @@ void tty_buffer_flush(struct tty_struct *tty)
188{ 166{
189 struct tty_port *port = tty->port; 167 struct tty_port *port = tty->port;
190 struct tty_bufhead *buf = &port->buf; 168 struct tty_bufhead *buf = &port->buf;
169 struct tty_buffer *next;
191 170
192 buf->flushpending = 1; 171 buf->flushpending = 1;
193 172
194 mutex_lock(&buf->flush_mutex); 173 mutex_lock(&buf->flush_mutex);
195 __tty_buffer_flush(port); 174 while ((next = buf->head->next) != NULL) {
175 tty_buffer_free(port, buf->head);
176 buf->head = next;
177 }
178 buf->head->read = buf->head->commit;
196 buf->flushpending = 0; 179 buf->flushpending = 0;
197 mutex_unlock(&buf->flush_mutex); 180 mutex_unlock(&buf->flush_mutex);
198} 181}