Skip to content

Commit

Permalink
timer: Prepare to change all DEFINE_TIMER() callbacks
Browse files Browse the repository at this point in the history
Before we can globally change the function prototype of all timer callbacks,
we have to change those set up by DEFINE_TIMER(). Prepare for this by
casting the callbacks until the prototype changes globally.

Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
Kees Cook committed Nov 8, 2017
1 parent 8ef81c6 commit 3653bc9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/linux/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ struct timer_list {

#define TIMER_TRACE_FLAGMASK (TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE)

#define TIMER_DATA_TYPE unsigned long
#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)

#define __TIMER_INITIALIZER(_function, _data, _flags) { \
.entry = { .next = TIMER_ENTRY_STATIC }, \
.function = (_function), \
Expand All @@ -74,7 +77,7 @@ struct timer_list {

#define DEFINE_TIMER(_name, _function) \
struct timer_list _name = \
__TIMER_INITIALIZER(_function, 0, 0)
__TIMER_INITIALIZER((TIMER_FUNC_TYPE)_function, 0, 0)

void init_timer_key(struct timer_list *timer, unsigned int flags,
const char *name, struct lock_class_key *key);
Expand Down Expand Up @@ -147,9 +150,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
#define setup_pinned_deferrable_timer_on_stack(timer, fn, data) \
__setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED)

#define TIMER_DATA_TYPE unsigned long
#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)

#ifndef CONFIG_LOCKDEP
static inline void timer_setup(struct timer_list *timer,
void (*callback)(struct timer_list *),
Expand Down

0 comments on commit 3653bc9

Please sign in to comment.