From c597df93a1dfcf9ce4b27b38381085e4fb6ce3cd Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 25 Mar 2019 04:18:40 +0000 Subject: [PATCH 1/2] scst/include/backport.h: Make it possible to include this header file first git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8069 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 2e8603c03..a4d0a8d87 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -20,6 +20,7 @@ * GNU General Public License for more details. */ +#include #include #include /* struct request_queue */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 21, 0) @@ -34,7 +35,6 @@ #include /* kmalloc() */ #include /* sizeof_field() */ #include -#include #include #include /* sync_page_range() */ #include From 11d56f4129c9eed56a103faae8727548c256ee5c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 25 Mar 2019 04:19:24 +0000 Subject: [PATCH 2/2] 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").