compat: provide INIT_WORK with 2 arguments for kernels before 2.6.20
authorPavel Roskin <proski@gnu.org>
Fri, 23 Sep 2011 21:48:05 +0000 (17:48 -0400)
committerLuis R. Rodriguez <mcgrof@qca.qualcomm.com>
Fri, 23 Sep 2011 21:49:44 +0000 (14:49 -0700)
Also provide work_func_t.  Originally implemented and tested in
ndiswrapper.

Signed-off-by: Pavel Roskin <proski@gnu.org>
include/linux/compat-2.6.20.h [new file with mode: 0644]

diff --git a/include/linux/compat-2.6.20.h b/include/linux/compat-2.6.20.h
new file mode 100644 (file)
index 0000000..14579e2
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef LINUX_26_20_COMPAT_H
+#define LINUX_26_20_COMPAT_H
+
+#include <linux/version.h>
+
+/* Compat work for 2.6.20 */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
+
+#include <linux/workqueue.h>
+
+typedef void (*work_func_t)(struct work_struct *work);
+typedef void (*compat_work_func_t)(void *work);
+static inline void (INIT_WORK)(struct work_struct *work, work_func_t func)
+{
+       INIT_WORK(work, (compat_work_func_t)func, work);
+}
+#undef INIT_WORK
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) */
+
+#endif /* LINUX_26_20_COMPAT_H */