summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-10-15 00:34:55 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2009-10-15 00:34:55 +0200
commitd6047d79b90f6122fcbf2c3e783b507f7dd78fc6 (patch)
tree4091ff408dd6873609e3f3341b0b3972155b7201 /kernel
parentMerge branch 'topic/x86-lds-nits' of git://git.kernel.org/pub/scm/linux/kerne... (diff)
parenttty: use the new 'flush_delayed_work()' helper to do ldisc flush (diff)
downloadlinux-d6047d79b90f6122fcbf2c3e783b507f7dd78fc6.tar.xz
linux-d6047d79b90f6122fcbf2c3e783b507f7dd78fc6.zip
Merge branch 'tty-fixes'
* branch 'tty-fixes': tty: use the new 'flush_delayed_work()' helper to do ldisc flush workqueue: add 'flush_delayed_work()' to run and wait for delayed work Make flush_to_ldisc properly handle parallel calls
Diffstat (limited to 'kernel')
-rw-r--r--kernel/workqueue.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index addfe2df93b1..ccefe574dcf7 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -640,6 +640,24 @@ int schedule_delayed_work(struct delayed_work *dwork,
EXPORT_SYMBOL(schedule_delayed_work);
/**
+ * flush_delayed_work - block until a dwork_struct's callback has terminated
+ * @dwork: the delayed work which is to be flushed
+ *
+ * Any timeout is cancelled, and any pending work is run immediately.
+ */
+void flush_delayed_work(struct delayed_work *dwork)
+{
+ if (del_timer(&dwork->timer)) {
+ struct cpu_workqueue_struct *cwq;
+ cwq = wq_per_cpu(keventd_wq, get_cpu());
+ __queue_work(cwq, &dwork->work);
+ put_cpu();
+ }
+ flush_work(&dwork->work);
+}
+EXPORT_SYMBOL(flush_delayed_work);
+
+/**
* schedule_delayed_work_on - queue work in global workqueue on CPU after delay
* @cpu: cpu to use
* @dwork: job to be done