diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-22 21:22:50 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-11-21 18:57:14 -0500 |
commit | 1fe66ba572b455270dc35a2c099dd7328cec9e4c (patch) | |
tree | 28ef99f61598350d30e3cd86636e21485cac4a6b | |
parent | 354b46b1a0adda1dd5b7f0bc2a5604cca091be5f (diff) |
timer: Remove unused data arguments from macros
With the .data field removed, the ignored data arguments in timer macros
can be removed.
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Shaohua Li <shli@fb.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r-- | include/linux/kthread.h | 2 | ||||
-rw-r--r-- | include/linux/timer.h | 18 | ||||
-rw-r--r-- | include/linux/workqueue.h | 3 |
3 files changed, 8 insertions, 15 deletions
diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 3203e36b2ee8..b855c5b72b26 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h | |||
@@ -119,7 +119,6 @@ struct kthread_delayed_work { | |||
119 | #define KTHREAD_DELAYED_WORK_INIT(dwork, fn) { \ | 119 | #define KTHREAD_DELAYED_WORK_INIT(dwork, fn) { \ |
120 | .work = KTHREAD_WORK_INIT((dwork).work, (fn)), \ | 120 | .work = KTHREAD_WORK_INIT((dwork).work, (fn)), \ |
121 | .timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\ | 121 | .timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\ |
122 | (TIMER_DATA_TYPE)&(dwork.timer), \ | ||
123 | TIMER_IRQSAFE), \ | 122 | TIMER_IRQSAFE), \ |
124 | } | 123 | } |
125 | 124 | ||
@@ -167,7 +166,6 @@ extern void __kthread_init_worker(struct kthread_worker *worker, | |||
167 | kthread_init_work(&(dwork)->work, (fn)); \ | 166 | kthread_init_work(&(dwork)->work, (fn)); \ |
168 | __setup_timer(&(dwork)->timer, \ | 167 | __setup_timer(&(dwork)->timer, \ |
169 | (TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\ | 168 | (TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\ |
170 | (TIMER_DATA_TYPE)&(dwork)->timer, \ | ||
171 | TIMER_IRQSAFE); \ | 169 | TIMER_IRQSAFE); \ |
172 | } while (0) | 170 | } while (0) |
173 | 171 | ||
diff --git a/include/linux/timer.h b/include/linux/timer.h index a6d04fb72c9e..e6bab51db13d 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -66,7 +66,7 @@ struct timer_list { | |||
66 | #define TIMER_DATA_TYPE struct timer_list * | 66 | #define TIMER_DATA_TYPE struct timer_list * |
67 | #define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE) | 67 | #define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE) |
68 | 68 | ||
69 | #define __TIMER_INITIALIZER(_function, _data, _flags) { \ | 69 | #define __TIMER_INITIALIZER(_function, _flags) { \ |
70 | .entry = { .next = TIMER_ENTRY_STATIC }, \ | 70 | .entry = { .next = TIMER_ENTRY_STATIC }, \ |
71 | .function = (_function), \ | 71 | .function = (_function), \ |
72 | .flags = (_flags), \ | 72 | .flags = (_flags), \ |
@@ -76,7 +76,7 @@ struct timer_list { | |||
76 | 76 | ||
77 | #define DEFINE_TIMER(_name, _function) \ | 77 | #define DEFINE_TIMER(_name, _function) \ |
78 | struct timer_list _name = \ | 78 | struct timer_list _name = \ |
79 | __TIMER_INITIALIZER((TIMER_FUNC_TYPE)_function, 0, 0) | 79 | __TIMER_INITIALIZER((TIMER_FUNC_TYPE)_function, 0) |
80 | 80 | ||
81 | void init_timer_key(struct timer_list *timer, unsigned int flags, | 81 | void init_timer_key(struct timer_list *timer, unsigned int flags, |
82 | const char *name, struct lock_class_key *key); | 82 | const char *name, struct lock_class_key *key); |
@@ -115,13 +115,13 @@ static inline void init_timer_on_stack_key(struct timer_list *timer, | |||
115 | init_timer_on_stack_key((_timer), (_flags), NULL, NULL) | 115 | init_timer_on_stack_key((_timer), (_flags), NULL, NULL) |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | #define __setup_timer(_timer, _fn, _data, _flags) \ | 118 | #define __setup_timer(_timer, _fn, _flags) \ |
119 | do { \ | 119 | do { \ |
120 | __init_timer((_timer), (_flags)); \ | 120 | __init_timer((_timer), (_flags)); \ |
121 | (_timer)->function = (_fn); \ | 121 | (_timer)->function = (_fn); \ |
122 | } while (0) | 122 | } while (0) |
123 | 123 | ||
124 | #define __setup_timer_on_stack(_timer, _fn, _data, _flags) \ | 124 | #define __setup_timer_on_stack(_timer, _fn, _flags) \ |
125 | do { \ | 125 | do { \ |
126 | __init_timer_on_stack((_timer), (_flags)); \ | 126 | __init_timer_on_stack((_timer), (_flags)); \ |
127 | (_timer)->function = (_fn); \ | 127 | (_timer)->function = (_fn); \ |
@@ -132,16 +132,14 @@ static inline void timer_setup(struct timer_list *timer, | |||
132 | void (*callback)(struct timer_list *), | 132 | void (*callback)(struct timer_list *), |
133 | unsigned int flags) | 133 | unsigned int flags) |
134 | { | 134 | { |
135 | __setup_timer(timer, (TIMER_FUNC_TYPE)callback, | 135 | __setup_timer(timer, (TIMER_FUNC_TYPE)callback, flags); |
136 | (TIMER_DATA_TYPE)timer, flags); | ||
137 | } | 136 | } |
138 | 137 | ||
139 | static inline void timer_setup_on_stack(struct timer_list *timer, | 138 | static inline void timer_setup_on_stack(struct timer_list *timer, |
140 | void (*callback)(struct timer_list *), | 139 | void (*callback)(struct timer_list *), |
141 | unsigned int flags) | 140 | unsigned int flags) |
142 | { | 141 | { |
143 | __setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback, | 142 | __setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback, flags); |
144 | (TIMER_DATA_TYPE)timer, flags); | ||
145 | } | 143 | } |
146 | #else | 144 | #else |
147 | /* | 145 | /* |
@@ -151,11 +149,11 @@ static inline void timer_setup_on_stack(struct timer_list *timer, | |||
151 | */ | 149 | */ |
152 | # define timer_setup(timer, callback, flags) \ | 150 | # define timer_setup(timer, callback, flags) \ |
153 | __setup_timer((timer), (TIMER_FUNC_TYPE)(callback), \ | 151 | __setup_timer((timer), (TIMER_FUNC_TYPE)(callback), \ |
154 | (TIMER_DATA_TYPE)(timer), (flags)) | 152 | (flags)) |
155 | # define timer_setup_on_stack(timer, callback, flags) \ | 153 | # define timer_setup_on_stack(timer, callback, flags) \ |
156 | __setup_timer_on_stack((timer), \ | 154 | __setup_timer_on_stack((timer), \ |
157 | (TIMER_FUNC_TYPE)(callback), \ | 155 | (TIMER_FUNC_TYPE)(callback), \ |
158 | (TIMER_DATA_TYPE)(timer), (flags)) | 156 | (flags)) |
159 | #endif | 157 | #endif |
160 | 158 | ||
161 | #define from_timer(var, callback_timer, timer_fieldname) \ | 159 | #define from_timer(var, callback_timer, timer_fieldname) \ |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 01a050fc6650..8d11580237f5 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -177,7 +177,6 @@ struct execute_work { | |||
177 | #define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \ | 177 | #define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \ |
178 | .work = __WORK_INITIALIZER((n).work, (f)), \ | 178 | .work = __WORK_INITIALIZER((n).work, (f)), \ |
179 | .timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)delayed_work_timer_fn,\ | 179 | .timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)delayed_work_timer_fn,\ |
180 | (TIMER_DATA_TYPE)&(n.timer), \ | ||
181 | (tflags) | TIMER_IRQSAFE), \ | 180 | (tflags) | TIMER_IRQSAFE), \ |
182 | } | 181 | } |
183 | 182 | ||
@@ -244,7 +243,6 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; } | |||
244 | INIT_WORK(&(_work)->work, (_func)); \ | 243 | INIT_WORK(&(_work)->work, (_func)); \ |
245 | __setup_timer(&(_work)->timer, \ | 244 | __setup_timer(&(_work)->timer, \ |
246 | (TIMER_FUNC_TYPE)delayed_work_timer_fn, \ | 245 | (TIMER_FUNC_TYPE)delayed_work_timer_fn, \ |
247 | (TIMER_DATA_TYPE)&(_work)->timer, \ | ||
248 | (_tflags) | TIMER_IRQSAFE); \ | 246 | (_tflags) | TIMER_IRQSAFE); \ |
249 | } while (0) | 247 | } while (0) |
250 | 248 | ||
@@ -253,7 +251,6 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; } | |||
253 | INIT_WORK_ONSTACK(&(_work)->work, (_func)); \ | 251 | INIT_WORK_ONSTACK(&(_work)->work, (_func)); \ |
254 | __setup_timer_on_stack(&(_work)->timer, \ | 252 | __setup_timer_on_stack(&(_work)->timer, \ |
255 | (TIMER_FUNC_TYPE)delayed_work_timer_fn,\ | 253 | (TIMER_FUNC_TYPE)delayed_work_timer_fn,\ |
256 | (TIMER_DATA_TYPE)&(_work)->timer,\ | ||
257 | (_tflags) | TIMER_IRQSAFE); \ | 254 | (_tflags) | TIMER_IRQSAFE); \ |
258 | } while (0) | 255 | } while (0) |
259 | 256 | ||