From 11d56f4129c9eed56a103faae8727548c256ee5c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 25 Mar 2019 04:19:24 +0000 Subject: [PATCH] scst/include/backport.h: Fix the timer_setup() backport and add a from_timer() backport git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8070 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index a4d0a8d87..7715ffbe1 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1170,10 +1170,10 @@ struct t10_pi_tuple { /* * See also commit 686fef928bba ("timer: Prepare to change timer callback - * argument type"). See also commit 0eeda71bc30d ("timer: Replace timer base - * by a cpu index"). + * argument type") # v4.14. See also commit 0eeda71bc30d ("timer: Replace + * timer base by a cpu index") # v4.2. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) #define timer_setup(_timer, _fn, _flags) do { \ init_timer(_timer); \ (_timer)->function = (void *)(_fn); \ @@ -1189,6 +1189,11 @@ struct t10_pi_tuple { } while (0) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) +#define from_timer(var, callback_timer, timer_fieldname) \ + container_of(callback_timer, typeof(*var), timer_fieldname) +#endif + /* * See also commit 1d27e3e2252b ("timer: Remove expires and data arguments * from DEFINE_TIMER").