1 dnl # 4.14-rc3 API change
2 dnl # https://lwn.net/Articles/735887/
4 dnl # Check if timer_list.func get passed a timer_list or an unsigned long
5 dnl # (older kernels). Also sanity check the from_timer() and timer_setup()
6 dnl # macros are available as well, since they will be used in the same newer
7 dnl # kernels that support the new timer_list.func signature.
9 dnl # Also check for the existance of flags in struct timer_list, they were
10 dnl # added in 4.1-rc8 via 0eeda71bc30d.
12 AC_DEFUN([ZFS_AC_KERNEL_TIMER_SETUP], [
13 AC_MSG_CHECKING([whether timer_setup() is available])
14 tmp_flags="$EXTRA_KCFLAGS"
15 EXTRA_KCFLAGS="-Werror"
17 ZFS_LINUX_TRY_COMPILE([
18 #include <linux/timer.h>
20 struct my_task_timer {
21 struct timer_list timer;
25 void task_expire(struct timer_list *tl)
27 struct my_task_timer *task_timer = from_timer(task_timer, tl, timer);
28 task_timer->data = 42;
31 struct my_task_timer task_timer;
32 timer_setup(&task_timer.timer, task_expire, 0);
35 AC_DEFINE(HAVE_KERNEL_TIMER_SETUP, 1,
36 [timer_setup() is available])
41 AC_MSG_CHECKING([whether timer function expects timer_list])
43 ZFS_LINUX_TRY_COMPILE([
44 #include <linux/timer.h>
45 void task_expire(struct timer_list *tl) {}
48 tl.function = task_expire;
51 AC_DEFINE(HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST, 1,
52 [timer_list.function gets a timer_list])
57 AC_MSG_CHECKING([whether struct timer_list has flags])
59 ZFS_LINUX_TRY_COMPILE([
60 #include <linux/timer.h>
66 AC_DEFINE(HAVE_KERNEL_TIMER_LIST_FLAGS, 1,
67 [struct timer_list has a flags member])
72 EXTRA_KCFLAGS="$tmp_flags"