diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-04-25 16:31:47 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2013-05-16 05:09:16 -0400 |
commit | 7172a286ced0c1f4f239a0fa09db54ed37d3ead2 (patch) | |
tree | c70ffdd57d6f980e0e2d0bc78951bc35089c5565 /kernel/time | |
parent | a89c7edbe7d7aa80f507915f3dd801211b116b79 (diff) |
clockevents: Get rid of the notifier chain
7+ years and still a single user. Kill it.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Magnus Damm <magnus.damm@gmail.com>
Link: http://lkml.kernel.org/r/20130425143436.098520211@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/clockevents.c | 35 | ||||
-rw-r--r-- | kernel/time/tick-broadcast.c | 5 | ||||
-rw-r--r-- | kernel/time/tick-common.c | 30 | ||||
-rw-r--r-- | kernel/time/tick-internal.h | 7 |
4 files changed, 14 insertions, 63 deletions
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index c6d6400ee137..dd70b4842c62 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/hrtimer.h> | 15 | #include <linux/hrtimer.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/notifier.h> | ||
19 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
20 | 19 | ||
21 | #include "tick-internal.h" | 20 | #include "tick-internal.h" |
@@ -23,10 +22,6 @@ | |||
23 | /* The registered clock event devices */ | 22 | /* The registered clock event devices */ |
24 | static LIST_HEAD(clockevent_devices); | 23 | static LIST_HEAD(clockevent_devices); |
25 | static LIST_HEAD(clockevents_released); | 24 | static LIST_HEAD(clockevents_released); |
26 | |||
27 | /* Notification for clock events */ | ||
28 | static RAW_NOTIFIER_HEAD(clockevents_chain); | ||
29 | |||
30 | /* Protection for the above */ | 25 | /* Protection for the above */ |
31 | static DEFINE_RAW_SPINLOCK(clockevents_lock); | 26 | static DEFINE_RAW_SPINLOCK(clockevents_lock); |
32 | 27 | ||
@@ -232,30 +227,6 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, | |||
232 | return (rc && force) ? clockevents_program_min_delta(dev) : rc; | 227 | return (rc && force) ? clockevents_program_min_delta(dev) : rc; |
233 | } | 228 | } |
234 | 229 | ||
235 | /** | ||
236 | * clockevents_register_notifier - register a clock events change listener | ||
237 | */ | ||
238 | int clockevents_register_notifier(struct notifier_block *nb) | ||
239 | { | ||
240 | unsigned long flags; | ||
241 | int ret; | ||
242 | |||
243 | raw_spin_lock_irqsave(&clockevents_lock, flags); | ||
244 | ret = raw_notifier_chain_register(&clockevents_chain, nb); | ||
245 | raw_spin_unlock_irqrestore(&clockevents_lock, flags); | ||
246 | |||
247 | return ret; | ||
248 | } | ||
249 | |||
250 | /* | ||
251 | * Notify about a clock event change. Called with clockevents_lock | ||
252 | * held. | ||
253 | */ | ||
254 | static void clockevents_do_notify(unsigned long reason, void *dev) | ||
255 | { | ||
256 | raw_notifier_call_chain(&clockevents_chain, reason, dev); | ||
257 | } | ||
258 | |||
259 | /* | 230 | /* |
260 | * Called after a notify add to make devices available which were | 231 | * Called after a notify add to make devices available which were |
261 | * released from the notifier call. | 232 | * released from the notifier call. |
@@ -269,7 +240,7 @@ static void clockevents_notify_released(void) | |||
269 | struct clock_event_device, list); | 240 | struct clock_event_device, list); |
270 | list_del(&dev->list); | 241 | list_del(&dev->list); |
271 | list_add(&dev->list, &clockevent_devices); | 242 | list_add(&dev->list, &clockevent_devices); |
272 | clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev); | 243 | tick_check_new_device(dev); |
273 | } | 244 | } |
274 | } | 245 | } |
275 | 246 | ||
@@ -290,7 +261,7 @@ void clockevents_register_device(struct clock_event_device *dev) | |||
290 | raw_spin_lock_irqsave(&clockevents_lock, flags); | 261 | raw_spin_lock_irqsave(&clockevents_lock, flags); |
291 | 262 | ||
292 | list_add(&dev->list, &clockevent_devices); | 263 | list_add(&dev->list, &clockevent_devices); |
293 | clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev); | 264 | tick_check_new_device(dev); |
294 | clockevents_notify_released(); | 265 | clockevents_notify_released(); |
295 | 266 | ||
296 | raw_spin_unlock_irqrestore(&clockevents_lock, flags); | 267 | raw_spin_unlock_irqrestore(&clockevents_lock, flags); |
@@ -433,7 +404,7 @@ void clockevents_notify(unsigned long reason, void *arg) | |||
433 | int cpu; | 404 | int cpu; |
434 | 405 | ||
435 | raw_spin_lock_irqsave(&clockevents_lock, flags); | 406 | raw_spin_lock_irqsave(&clockevents_lock, flags); |
436 | clockevents_do_notify(reason, arg); | 407 | tick_notify(reason, arg); |
437 | 408 | ||
438 | switch (reason) { | 409 | switch (reason) { |
439 | case CLOCK_EVT_NOTIFY_CPU_DEAD: | 410 | case CLOCK_EVT_NOTIFY_CPU_DEAD: |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 24938d577669..3500caaa0bfd 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -64,7 +64,7 @@ static void tick_broadcast_start_periodic(struct clock_event_device *bc) | |||
64 | /* | 64 | /* |
65 | * Check, if the device can be utilized as broadcast device: | 65 | * Check, if the device can be utilized as broadcast device: |
66 | */ | 66 | */ |
67 | int tick_check_broadcast_device(struct clock_event_device *dev) | 67 | void tick_install_broadcast_device(struct clock_event_device *dev) |
68 | { | 68 | { |
69 | struct clock_event_device *cur = tick_broadcast_device.evtdev; | 69 | struct clock_event_device *cur = tick_broadcast_device.evtdev; |
70 | 70 | ||
@@ -72,7 +72,7 @@ int tick_check_broadcast_device(struct clock_event_device *dev) | |||
72 | (tick_broadcast_device.evtdev && | 72 | (tick_broadcast_device.evtdev && |
73 | tick_broadcast_device.evtdev->rating >= dev->rating) || | 73 | tick_broadcast_device.evtdev->rating >= dev->rating) || |
74 | (dev->features & CLOCK_EVT_FEAT_C3STOP)) | 74 | (dev->features & CLOCK_EVT_FEAT_C3STOP)) |
75 | return 0; | 75 | return; |
76 | 76 | ||
77 | clockevents_exchange_device(tick_broadcast_device.evtdev, dev); | 77 | clockevents_exchange_device(tick_broadcast_device.evtdev, dev); |
78 | if (cur) | 78 | if (cur) |
@@ -90,7 +90,6 @@ int tick_check_broadcast_device(struct clock_event_device *dev) | |||
90 | */ | 90 | */ |
91 | if (dev->features & CLOCK_EVT_FEAT_ONESHOT) | 91 | if (dev->features & CLOCK_EVT_FEAT_ONESHOT) |
92 | tick_clock_notify(); | 92 | tick_clock_notify(); |
93 | return 1; | ||
94 | } | 93 | } |
95 | 94 | ||
96 | /* | 95 | /* |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 5d3fb100bc06..dbf4e18d5101 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -208,11 +208,11 @@ static void tick_setup_device(struct tick_device *td, | |||
208 | /* | 208 | /* |
209 | * Check, if the new registered device should be used. | 209 | * Check, if the new registered device should be used. |
210 | */ | 210 | */ |
211 | static int tick_check_new_device(struct clock_event_device *newdev) | 211 | void tick_check_new_device(struct clock_event_device *newdev) |
212 | { | 212 | { |
213 | struct clock_event_device *curdev; | 213 | struct clock_event_device *curdev; |
214 | struct tick_device *td; | 214 | struct tick_device *td; |
215 | int cpu, ret = NOTIFY_OK; | 215 | int cpu; |
216 | unsigned long flags; | 216 | unsigned long flags; |
217 | 217 | ||
218 | raw_spin_lock_irqsave(&tick_device_lock, flags); | 218 | raw_spin_lock_irqsave(&tick_device_lock, flags); |
@@ -275,18 +275,14 @@ static int tick_check_new_device(struct clock_event_device *newdev) | |||
275 | tick_oneshot_notify(); | 275 | tick_oneshot_notify(); |
276 | 276 | ||
277 | raw_spin_unlock_irqrestore(&tick_device_lock, flags); | 277 | raw_spin_unlock_irqrestore(&tick_device_lock, flags); |
278 | return NOTIFY_STOP; | 278 | return; |
279 | 279 | ||
280 | out_bc: | 280 | out_bc: |
281 | /* | 281 | /* |
282 | * Can the new device be used as a broadcast device ? | 282 | * Can the new device be used as a broadcast device ? |
283 | */ | 283 | */ |
284 | if (tick_check_broadcast_device(newdev)) | 284 | tick_install_broadcast_device(newdev); |
285 | ret = NOTIFY_STOP; | ||
286 | |||
287 | raw_spin_unlock_irqrestore(&tick_device_lock, flags); | 285 | raw_spin_unlock_irqrestore(&tick_device_lock, flags); |
288 | |||
289 | return ret; | ||
290 | } | 286 | } |
291 | 287 | ||
292 | /* | 288 | /* |
@@ -360,17 +356,10 @@ static void tick_resume(void) | |||
360 | raw_spin_unlock_irqrestore(&tick_device_lock, flags); | 356 | raw_spin_unlock_irqrestore(&tick_device_lock, flags); |
361 | } | 357 | } |
362 | 358 | ||
363 | /* | 359 | void tick_notify(unsigned long reason, void *dev) |
364 | * Notification about clock event devices | ||
365 | */ | ||
366 | static int tick_notify(struct notifier_block *nb, unsigned long reason, | ||
367 | void *dev) | ||
368 | { | 360 | { |
369 | switch (reason) { | 361 | switch (reason) { |
370 | 362 | ||
371 | case CLOCK_EVT_NOTIFY_ADD: | ||
372 | return tick_check_new_device(dev); | ||
373 | |||
374 | case CLOCK_EVT_NOTIFY_BROADCAST_ON: | 363 | case CLOCK_EVT_NOTIFY_BROADCAST_ON: |
375 | case CLOCK_EVT_NOTIFY_BROADCAST_OFF: | 364 | case CLOCK_EVT_NOTIFY_BROADCAST_OFF: |
376 | case CLOCK_EVT_NOTIFY_BROADCAST_FORCE: | 365 | case CLOCK_EVT_NOTIFY_BROADCAST_FORCE: |
@@ -404,21 +393,12 @@ static int tick_notify(struct notifier_block *nb, unsigned long reason, | |||
404 | default: | 393 | default: |
405 | break; | 394 | break; |
406 | } | 395 | } |
407 | |||
408 | return NOTIFY_OK; | ||
409 | } | 396 | } |
410 | 397 | ||
411 | static struct notifier_block tick_notifier = { | ||
412 | .notifier_call = tick_notify, | ||
413 | }; | ||
414 | |||
415 | /** | 398 | /** |
416 | * tick_init - initialize the tick control | 399 | * tick_init - initialize the tick control |
417 | * | ||
418 | * Register the notifier with the clockevents framework | ||
419 | */ | 400 | */ |
420 | void __init tick_init(void) | 401 | void __init tick_init(void) |
421 | { | 402 | { |
422 | clockevents_register_notifier(&tick_notifier); | ||
423 | tick_broadcast_init(); | 403 | tick_broadcast_init(); |
424 | } | 404 | } |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index f0299eae4602..60742fe6f63d 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -18,6 +18,8 @@ extern int tick_do_timer_cpu __read_mostly; | |||
18 | 18 | ||
19 | extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast); | 19 | extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast); |
20 | extern void tick_handle_periodic(struct clock_event_device *dev); | 20 | extern void tick_handle_periodic(struct clock_event_device *dev); |
21 | extern void tick_notify(unsigned long reason, void *dev); | ||
22 | extern void tick_check_new_device(struct clock_event_device *dev); | ||
21 | 23 | ||
22 | extern void clockevents_shutdown(struct clock_event_device *dev); | 24 | extern void clockevents_shutdown(struct clock_event_device *dev); |
23 | 25 | ||
@@ -90,7 +92,7 @@ static inline bool tick_broadcast_oneshot_available(void) { return false; } | |||
90 | */ | 92 | */ |
91 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 93 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
92 | extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu); | 94 | extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu); |
93 | extern int tick_check_broadcast_device(struct clock_event_device *dev); | 95 | extern void tick_install_broadcast_device(struct clock_event_device *dev); |
94 | extern int tick_is_broadcast_device(struct clock_event_device *dev); | 96 | extern int tick_is_broadcast_device(struct clock_event_device *dev); |
95 | extern void tick_broadcast_on_off(unsigned long reason, int *oncpu); | 97 | extern void tick_broadcast_on_off(unsigned long reason, int *oncpu); |
96 | extern void tick_shutdown_broadcast(unsigned int *cpup); | 98 | extern void tick_shutdown_broadcast(unsigned int *cpup); |
@@ -102,9 +104,8 @@ tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); | |||
102 | 104 | ||
103 | #else /* !BROADCAST */ | 105 | #else /* !BROADCAST */ |
104 | 106 | ||
105 | static inline int tick_check_broadcast_device(struct clock_event_device *dev) | 107 | static inline void tick_install_broadcast_device(struct clock_event_device *dev) |
106 | { | 108 | { |
107 | return 0; | ||
108 | } | 109 | } |
109 | 110 | ||
110 | static inline int tick_is_broadcast_device(struct clock_event_device *dev) | 111 | static inline int tick_is_broadcast_device(struct clock_event_device *dev) |