build: Add support for timer_setup
Commit Message
Literally copied the implementation from kernel
commit 686fef928bba6be13 (timer: Prepare to change timer callback argument type)
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
---
v4l/compat.h | 17 +++++++++++++++++
v4l/scripts/make_config_compat.pl | 1 +
2 files changed, 18 insertions(+)
@@ -2195,4 +2195,21 @@ static inline void *bsearch(const void *key, const void *base, size_t num, size_
}
#endif
+#ifdef NEED_TIMER_SETUP
+#define TIMER_DATA_TYPE unsigned long
+#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)
+
+static inline void timer_setup(struct timer_list *timer,
+ void (*callback)(struct timer_list *),
+ unsigned int flags)
+{
+ __setup_timer(timer, (TIMER_FUNC_TYPE)callback,
+ (TIMER_DATA_TYPE)timer, flags);
+}
+
+#define from_timer(var, callback_timer, timer_fieldname) \
+ container_of(callback_timer, typeof(*var), timer_fieldname)
+
+#endif
+
#endif /* _COMPAT_H */
@@ -706,6 +706,7 @@ sub check_other_dependencies()
check_files_for_func("annotate_reachable", "NEED_ANNOTATE_REACHABLE", "include/linux/compiler.h");
check_files_for_func("U32_MAX", "NEED_U32_MAX", "include/linux/kernel.h");
check_files_for_func("bsearch", "NEED_BSEARCH", "include/linux/bsearch.h");
+ check_files_for_func("timer_setup", "NEED_TIMER_SETUP", "include/linux/timer.h");
# For tests for uapi-dependent logic
check_files_for_func_uapi("usb_endpoint_maxp", "NEED_USB_ENDPOINT_MAXP", "usb/ch9.h");