aboutsummaryrefslogtreecommitdiff
path: root/include/linux
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:37 +0200
commitf4827f75f87194966922feb9e4d6077be2c2c50b (patch)
tree14e2d2dc4a018d65de1bef07329c4dd617be7675 /include/linux
parent059471026425621bf9256e433bcaafccd231aacb (diff)
downloadandroid_kernel_m2note-f4827f75f87194966922feb9e4d6077be2c2c50b.tar.gz
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/linux')
-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,