aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-12-13 13:20:46 +0100
committerTakashi Iwai <tiwai@suse.de>2010-12-13 13:20:46 +0100
commit377e8e15dac8150acff8f8b8bcbac70254c27ad4 (patch)
tree634c05c8b021901920e4f7956bbd743815865ddc
parent35d4f145aad655eeec7ac117f2c5fe083f13a3b3 (diff)
downloadalsa-driver-build-unstable-377e8e15dac8150acff8f8b8bcbac70254c27ad4.tar.gz
Add flush_work_sync() and flush_delayed_work_sync() wrappers
... somehow equivalent ones. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/adriver.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/adriver.h b/include/adriver.h
index 2a2f1aa64..6cc93e3e6 100644
--- a/include/adriver.h
+++ b/include/adriver.h
@@ -1932,6 +1932,30 @@ static inline void *vzalloc(unsigned long size)
}
#endif
+/* flush_delayed_work_sync() wrapper */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
+#include <linux/workqueue.h>
+static inline bool flush_work_sync(struct work_struct *work)
+{
+ if (!flush_work(work))
+ return false;
+ while (flush_work(work))
+ ;
+ return true;
+}
+
+static inline bool flush_delayed_work_sync(struct delayed_work *dwork)
+{
+ bool ret;
+ ret = cancel_delayed_work(dwork);
+ if (ret) {
+ schedule_delayed_work(dwork, 0);
+ flush_scheduled_work();
+ }
+ return ret;
+}
+#endif
+
/* hack - CONFIG_SND_HDA_INPUT_JACK can be wrongly set for older kernels */
#ifndef CONFIG_SND_JACK
#undef CONFIG_SND_HDA_INPUT_JACK