compat: timer.h: Remove last parameters from DEFINE_TIMER
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 4 Mar 2018 22:57:05 +0000 (23:57 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 21 Mar 2018 08:19:32 +0000 (09:19 +0100)
DEFINE_TIMER only has 2 parameters since kernel commit 1d27e3e2252ba
("timer: Remove expires and data arguments from DEFINE_TIMER") which was
added with kernel 4.15. Add a version which translates between the new
and the old API.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
backport/backport-include/linux/timer.h

index 9824ea6bd8890cafdcea517ea6593078f0d9b0a4..69590bb71324a5ebf90d705890560c61317a8f2d 100644 (file)
@@ -60,4 +60,11 @@ static inline void timer_setup(struct timer_list *timer,
        container_of(callback_timer, typeof(*var), timer_fieldname)
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,15,0)
+#undef DEFINE_TIMER
+#define DEFINE_TIMER(_name, _function)                         \
+       struct timer_list _name =                               \
+               __TIMER_INITIALIZER(_function, 0, 0, 0)
+#endif
+
 #endif /* _BACKPORT_TIMER_H */