Skip to content

Commit 3653bc9

Browse files
committed
timer: Prepare to change all DEFINE_TIMER() callbacks
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>
1 parent 8ef81c6 commit 3653bc9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/linux/timer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ struct timer_list {
6363

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

66+
#define TIMER_DATA_TYPE unsigned long
67+
#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)
68+
6669
#define __TIMER_INITIALIZER(_function, _data, _flags) { \
6770
.entry = { .next = TIMER_ENTRY_STATIC }, \
6871
.function = (_function), \
@@ -74,7 +77,7 @@ struct timer_list {
7477

7578
#define DEFINE_TIMER(_name, _function) \
7679
struct timer_list _name = \
77-
__TIMER_INITIALIZER(_function, 0, 0)
80+
__TIMER_INITIALIZER((TIMER_FUNC_TYPE)_function, 0, 0)
7881

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

150-
#define TIMER_DATA_TYPE unsigned long
151-
#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)
152-
153153
#ifndef CONFIG_LOCKDEP
154154
static inline void timer_setup(struct timer_list *timer,
155155
void (*callback)(struct timer_list *),

0 commit comments

Comments
 (0)