summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-22 18:14:46 -0700
committerKees Cook <keescook@chromium.org>2017-11-21 15:57:14 -0800
commit188665b2d67db8953899551d1a9d4481b2a0ac60 (patch)
treea2358bf68d3d4f8c7b775966a4e94cea7b7dc81c /include
parent1fe66ba572b455270dc35a2c099dd7328cec9e4c (diff)
timer: Pass function down to initialization routines
In preparation for removing more macros, pass the function down to the initialization routines instead of doing it in macros. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/timer.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/include/linux/timer.h b/include/linux/timer.h
index e6bab51db13d..aff73b1c8f7b 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -78,53 +78,56 @@ struct timer_list {
struct timer_list _name = \
__TIMER_INITIALIZER((TIMER_FUNC_TYPE)_function, 0)
-void init_timer_key(struct timer_list *timer, unsigned int flags,
+void init_timer_key(struct timer_list *timer,
+ void (*func)(struct timer_list *), unsigned int flags,
const char *name, struct lock_class_key *key);
#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
extern void init_timer_on_stack_key(struct timer_list *timer,
+ void (*func)(struct timer_list *),
unsigned int flags, const char *name,
struct lock_class_key *key);
extern void destroy_timer_on_stack(struct timer_list *timer);
#else
static inline void destroy_timer_on_stack(struct timer_list *timer) { }
static inline void init_timer_on_stack_key(struct timer_list *timer,
- unsigned int flags, const char *name,
+ void (*func)(struct timer_list *),
+ unsigned int flags,
+ const char *name,
struct lock_class_key *key)
{
- init_timer_key(timer, flags, name, key);
+ init_timer_key(timer, func, flags, name, key);
}
#endif
#ifdef CONFIG_LOCKDEP
-#define __init_timer(_timer, _flags) \
+#define __init_timer(_timer, _fn, _flags) \
do { \
static struct lock_class_key __key; \
- init_timer_key((_timer), (_flags), #_timer, &__key); \
+ init_timer_key((_timer), (_fn), (_flags), #_timer, &__key);\
} while (0)
-#define __init_timer_on_stack(_timer, _flags) \
+#define __init_timer_on_stack(_timer, _fn, _flags) \
do { \
static struct lock_class_key __key; \
- init_timer_on_stack_key((_timer), (_flags), #_timer, &__key); \
+ init_timer_on_stack_key((_timer), (_fn), (_flags), \
+ #_timer, &__key); \
} while (0)
#else
-#define __init_timer(_timer, _flags) \
- init_timer_key((_timer), (_flags), NULL, NULL)
-#define __init_timer_on_stack(_timer, _flags) \
- init_timer_on_stack_key((_timer), (_flags), NULL, NULL)
+#define __init_timer(_timer, _fn, _flags) \
+ init_timer_key((_timer), (_fn), (_flags), NULL, NULL)
+#define __init_timer_on_stack(_timer, _fn, _flags) \
+ init_timer_on_stack_key((_timer), (_fn), (_flags), NULL, NULL)
#endif
#define __setup_timer(_timer, _fn, _flags) \
do { \
- __init_timer((_timer), (_flags)); \
- (_timer)->function = (_fn); \
+ __init_timer((_timer), (_fn), (_flags)); \
} while (0)
#define __setup_timer_on_stack(_timer, _fn, _flags) \
do { \
- __init_timer_on_stack((_timer), (_flags)); \
- (_timer)->function = (_fn); \
+ __init_timer_on_stack((_timer), (_fn), (_flags)); \
} while (0)
#ifndef CONFIG_LOCKDEP