summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2022-07-07 10:25:57 +0200
committerAlexander Grund <flamefire89@gmail.com>2023-11-09 19:17:10 +0100
commitf714603039fbd41f14b37149ee50ced36666ed94 (patch)
tree51eb7d933225ff87b248cf246a376a2433cdcf58
parent9d0eb0082cdba627e720b12e9db80e5e3c884680 (diff)
tty: extract tty_flip_buffer_commit() from tty_flip_buffer_push()
commit 716b10580283fda66f2b88140e3964f8a7f9da89 upstream. 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> Change-Id: Iff30e1534948b64bf060c2b0ac290e541e4194b4 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> Alex: Adjust to changing tty_schedule_flip instead of tty_flip_buffer_push
-rw-r--r--drivers/tty/tty_buffer.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 8f1f668c4532..fe03c216ea2b 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -389,6 +389,15 @@ int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag)
}
EXPORT_SYMBOL(__tty_insert_flip_char);
+static inline void tty_flip_buffer_commit(struct tty_buffer *tail)
+{
+ /*
+ * Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees
+ * buffer data.
+ */
+ smp_store_release(&tail->commit, tail->used);
+}
+
/**
* tty_schedule_flip - push characters to ldisc
* @port: tty port to push from
@@ -402,10 +411,7 @@ void tty_schedule_flip(struct tty_port *port)
{
struct tty_bufhead *buf = &port->buf;
- /* paired w/ acquire in flush_to_ldisc(); ensures
- * flush_to_ldisc() sees buffer data.
- */
- smp_store_release(&buf->tail->commit, buf->tail->used);
+ tty_flip_buffer_commit(buf->tail);
queue_kthread_work(&port->worker, &buf->work);
}
EXPORT_SYMBOL(tty_schedule_flip);