Linux 4.15 compat: timer updates

Use timer_setup() macro and new timeout function definition.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #670
Closes #671
This commit is contained in:
Tony Hutter
2017-12-21 10:56:32 -08:00
committed by Brian Behlendorf
parent ed19bccfb6
commit c9821f1ccc
2 changed files with 59 additions and 2 deletions
+34
View File
@@ -54,6 +54,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_WAIT_QUEUE_HEAD_ENTRY
SPL_AC_KERNEL_WRITE
SPL_AC_KERNEL_READ
SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
@@ -1654,3 +1655,36 @@ AC_DEFUN([SPL_AC_KERNEL_READ], [
])
EXTRA_KCFLAGS="$tmp_flags"
])
dnl #
dnl # 4.15 API change
dnl # https://lkml.org/lkml/2017/11/25/90
dnl # Check if timer_list.func get passed a timer_list or an unsigned long
dnl # (older kernels). Also sanity check the from_timer() and timer_setup()
dnl # macros are available as well, since they will be used in the same newer
dnl # kernels that support the new timer_list.func signature.
dnl #
AC_DEFUN([SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST], [
AC_MSG_CHECKING([whether timer_list.function gets a timer_list])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
#include <linux/timer.h>
void task_expire(struct timer_list *tl) {}
],[
#ifndef from_timer
#error "No from_timer() macro"
#endif
struct timer_list timer;
timer.function = task_expire;
timer_setup(&timer, NULL, 0);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST, 1,
[timer_list.function gets a timer_list])
],[
AC_MSG_RESULT(no)
])
EXTRA_KCFLAGS="$tmp_flags"
])