aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPetr Mladek <pmladek@suse.com>2016-10-11 13:55:43 -0700
committerMister Oyster <oysterized@gmail.com>2017-09-04 01:58:51 +0200
commit3327e6cd628b5fa9d39a5039a00373f5da47c815 (patch)
tree468c70751738198b724abb7652a0036cd8179d65 /include
parent6859855ae9d010a8cef6c34411b10824a4019177 (diff)
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 <alex.naidis@linux.com> Signed-off-by: Joe Maples <joe@frap129.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/kthread.h12
1 files changed, 12 insertions, 0 deletions
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,