Skip to content

Commit

Permalink
tty: Merge __tty_flush_buffer() into lone call site
Browse files Browse the repository at this point in the history
__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>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Jul 23, 2013
1 parent 0f56bd2 commit 47aa658
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions drivers/tty/tty_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,6 @@ static void tty_buffer_free(struct tty_port *port, struct tty_buffer *b)
llist_add(&b->free, &buf->free);
}

/**
* __tty_buffer_flush - flush full tty buffers
* @tty: tty to flush
*
* flush all the buffers containing receive data. Caller must
* hold the buffer lock and must have ensured no parallel flush to
* ldisc is running.
*/

static void __tty_buffer_flush(struct tty_port *port)
{
struct tty_bufhead *buf = &port->buf;
struct tty_buffer *next;

while ((next = buf->head->next) != NULL) {
tty_buffer_free(port, buf->head);
buf->head = next;
}
WARN_ON(buf->head != buf->tail);
buf->head->read = buf->head->commit;
}

/**
* tty_buffer_flush - flush full tty buffers
* @tty: tty to flush
Expand All @@ -188,11 +166,16 @@ void tty_buffer_flush(struct tty_struct *tty)
{
struct tty_port *port = tty->port;
struct tty_bufhead *buf = &port->buf;
struct tty_buffer *next;

buf->flushpending = 1;

mutex_lock(&buf->flush_mutex);
__tty_buffer_flush(port);
while ((next = buf->head->next) != NULL) {
tty_buffer_free(port, buf->head);
buf->head = next;
}
buf->head->read = buf->head->commit;
buf->flushpending = 0;
mutex_unlock(&buf->flush_mutex);
}
Expand Down

0 comments on commit 47aa658

Please sign in to comment.