From 3327e6cd628b5fa9d39a5039a00373f5da47c815 Mon Sep 17 00:00:00 2001 From: Petr Mladek Date: Tue, 11 Oct 2016 13:55:43 -0700 Subject: kthread: Backport queuing_blocked() This patch backports the queuing_blocked() function from Linux mainline and places it into the kthread header so it is accessible everywhere. Signed-off-by: Alex Naidis Signed-off-by: Joe Maples --- include/linux/kthread.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 7dcef3317..f52ec33a3 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -130,6 +130,18 @@ extern void __init_kthread_worker(struct kthread_worker *worker, init_waitqueue_head(&(work)->done); \ } while (0) +/* + * Returns true when the work could not be queued at the moment. + * It happens when it is already pending in a worker list. + */ +static inline bool queuing_blocked(struct kthread_worker *worker, + struct kthread_work *work) +{ + lockdep_assert_held(&worker->lock); + + return !list_empty(&work->node); +} + int kthread_worker_fn(void *worker_ptr); bool queue_kthread_work(struct kthread_worker *worker, -- cgit v1.2.3