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
This commit is contained in:
Bart Van Assche
2019-03-25 04:19:24 +00:00
parent c597df93a1
commit 11d56f4129

View File

@@ -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").