lkml.org 
[lkml]   [2019]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 1/3] drivers/tty: refactor functions for flushing/queuing work
Date
From: Steven Walter <stevenrwalter@gmail.com>

Preparation for converting to kthread_worker

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/tty/tty_buffer.c | 12 +++++++++---
include/linux/tty.h | 1 +
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 77070c2d1240..e0090e65d83a 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -72,7 +72,7 @@ void tty_buffer_unlock_exclusive(struct tty_port *port)
atomic_dec(&buf->priority);
mutex_unlock(&buf->lock);
if (restart)
- queue_work(system_unbound_wq, &buf->work);
+ tty_buffer_queue_work(port);
}
EXPORT_SYMBOL_GPL(tty_buffer_unlock_exclusive);

@@ -410,7 +410,7 @@ void tty_schedule_flip(struct tty_port *port)
* flush_to_ldisc() sees buffer data.
*/
smp_store_release(&buf->tail->commit, buf->tail->used);
- queue_work(system_unbound_wq, &buf->work);
+ tty_buffer_queue_work(port);
}
EXPORT_SYMBOL(tty_schedule_flip);

@@ -557,6 +557,12 @@ void tty_flip_buffer_push(struct tty_port *port)
}
EXPORT_SYMBOL(tty_flip_buffer_push);

+bool tty_buffer_queue_work(struct tty_port *port)
+{
+ struct tty_bufhead *buf = &port->buf;
+ return schedule_work(&buf->work);
+}
+
/**
* tty_buffer_init - prepare a tty buffer structure
* @tty: tty to initialise
@@ -605,7 +611,7 @@ void tty_buffer_set_lock_subclass(struct tty_port *port)

bool tty_buffer_restart_work(struct tty_port *port)
{
- return queue_work(system_unbound_wq, &port->buf.work);
+ return tty_buffer_queue_work(port);
}

bool tty_buffer_cancel_work(struct tty_port *port)
diff --git a/include/linux/tty.h b/include/linux/tty.h
index bfa4e2ee94a9..226a9eff0766 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -507,6 +507,7 @@ extern void session_clear_tty(struct pid *session);
extern void no_tty(void);
extern void tty_buffer_free_all(struct tty_port *port);
extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld);
+extern bool tty_buffer_queue_work(struct tty_port *port);
extern void tty_buffer_init(struct tty_port *port);
extern void tty_buffer_set_lock_subclass(struct tty_port *port);
extern bool tty_buffer_restart_work(struct tty_port *port);
--
2.19.1
\
 
 \ /
  Last update: 2019-01-10 11:13    [W:0.098 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site