Skip to content

Commit 716b105

Browse files
Jiri Slabygregkh
authored andcommitted
tty: extract tty_flip_buffer_commit() from tty_flip_buffer_push()
We will need this new helper in the next patch. Cc: Hillf Danton <hdanton@sina.com> Cc: 一只狗 <chennbnbnb@gmail.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20220707082558.9250-1-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b941e48 commit 716b105

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

drivers/tty/tty_buffer.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,15 @@ static void flush_to_ldisc(struct work_struct *work)
532532

533533
}
534534

535+
static inline void tty_flip_buffer_commit(struct tty_buffer *tail)
536+
{
537+
/*
538+
* Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees
539+
* buffer data.
540+
*/
541+
smp_store_release(&tail->commit, tail->used);
542+
}
543+
535544
/**
536545
* tty_flip_buffer_push - push terminal buffers
537546
* @port: tty port to push
@@ -546,11 +555,7 @@ void tty_flip_buffer_push(struct tty_port *port)
546555
{
547556
struct tty_bufhead *buf = &port->buf;
548557

549-
/*
550-
* Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees
551-
* buffer data.
552-
*/
553-
smp_store_release(&buf->tail->commit, buf->tail->used);
558+
tty_flip_buffer_commit(buf->tail);
554559
queue_work(system_unbound_wq, &buf->work);
555560
}
556561
EXPORT_SYMBOL(tty_flip_buffer_push);

0 commit comments

Comments
 (0)