aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/tick-broadcast.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-02-27 06:51:33 -0500
committerIngo Molnar <mingo@kernel.org>2015-03-27 05:26:19 -0400
commit77e32c89a7117614ab3d66d20c1088de721abfaa (patch)
tree197d7d66684509bffc639fd31870026e0c3dafbe /kernel/time/tick-broadcast.c
parent554ef3876c6acdff1331feab10275e9e9e0adb84 (diff)
clockevents: Manage device's state separately for the core
'enum clock_event_mode' is used for two purposes today: - to pass mode to the driver of clockevent device::set_mode(). - for managing state of the device for clockevents core. For supporting new modes/states we have moved away from the legacy set_mode() callback to new per-mode/state callbacks. New modes/states shouldn't be exposed to the legacy (now OBSOLOTE) callbacks and so we shouldn't add new states to 'enum clock_event_mode'. Lets have separate enums for the two use cases mentioned above. Keep using the earlier enum for legacy set_mode() callback and mark it OBSOLETE. And add another enum to clearly specify the possible states of a clockevent device. This also renames the newly added per-mode callbacks to reflect state changes. We haven't got rid of 'mode' member of 'struct clock_event_device' as it is used by some of the clockevent drivers and it would automatically die down once we migrate those drivers to the new interface. It ('mode') is only updated now for the drivers using the legacy interface. Suggested-by: Peter Zijlstra <peterz@infradead.org> Suggested-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Kevin Hilman <khilman@linaro.org> Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com> Cc: linaro-kernel@lists.linaro.org Cc: linaro-networking@linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/b6b0143a8a57bd58352ad35e08c25424c879c0cb.1425037853.git.viresh.kumar@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/time/tick-broadcast.c')
-rw-r--r--kernel/time/tick-broadcast.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 542d5bb5c13d..f0f8ee9dbc28 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -303,7 +303,7 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
303 /* 303 /*
304 * The device is in periodic mode. No reprogramming necessary: 304 * The device is in periodic mode. No reprogramming necessary:
305 */ 305 */
306 if (dev->mode == CLOCK_EVT_MODE_PERIODIC) 306 if (dev->state == CLOCK_EVT_STATE_PERIODIC)
307 goto unlock; 307 goto unlock;
308 308
309 /* 309 /*
@@ -532,8 +532,8 @@ static int tick_broadcast_set_event(struct clock_event_device *bc, int cpu,
532{ 532{
533 int ret; 533 int ret;
534 534
535 if (bc->mode != CLOCK_EVT_MODE_ONESHOT) 535 if (bc->state != CLOCK_EVT_STATE_ONESHOT)
536 clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); 536 clockevents_set_state(bc, CLOCK_EVT_STATE_ONESHOT);
537 537
538 ret = clockevents_program_event(bc, expires, force); 538 ret = clockevents_program_event(bc, expires, force);
539 if (!ret) 539 if (!ret)
@@ -543,7 +543,7 @@ static int tick_broadcast_set_event(struct clock_event_device *bc, int cpu,
543 543
544int tick_resume_broadcast_oneshot(struct clock_event_device *bc) 544int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
545{ 545{
546 clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); 546 clockevents_set_state(bc, CLOCK_EVT_STATE_ONESHOT);
547 return 0; 547 return 0;
548} 548}
549 549
@@ -562,8 +562,8 @@ void tick_check_oneshot_broadcast_this_cpu(void)
562 * switched over, leave the device alone. 562 * switched over, leave the device alone.
563 */ 563 */
564 if (td->mode == TICKDEV_MODE_ONESHOT) { 564 if (td->mode == TICKDEV_MODE_ONESHOT) {
565 clockevents_set_mode(td->evtdev, 565 clockevents_set_state(td->evtdev,
566 CLOCK_EVT_MODE_ONESHOT); 566 CLOCK_EVT_STATE_ONESHOT);
567 } 567 }
568 } 568 }
569} 569}
@@ -666,7 +666,7 @@ static void broadcast_shutdown_local(struct clock_event_device *bc,
666 if (dev->next_event.tv64 < bc->next_event.tv64) 666 if (dev->next_event.tv64 < bc->next_event.tv64)
667 return; 667 return;
668 } 668 }
669 clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN); 669 clockevents_set_state(dev, CLOCK_EVT_STATE_SHUTDOWN);
670} 670}
671 671
672static void broadcast_move_bc(int deadcpu) 672static void broadcast_move_bc(int deadcpu)
@@ -741,7 +741,7 @@ int tick_broadcast_oneshot_control(unsigned long reason)
741 cpumask_clear_cpu(cpu, tick_broadcast_oneshot_mask); 741 cpumask_clear_cpu(cpu, tick_broadcast_oneshot_mask);
742 } else { 742 } else {
743 if (cpumask_test_and_clear_cpu(cpu, tick_broadcast_oneshot_mask)) { 743 if (cpumask_test_and_clear_cpu(cpu, tick_broadcast_oneshot_mask)) {
744 clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT); 744 clockevents_set_state(dev, CLOCK_EVT_STATE_ONESHOT);
745 /* 745 /*
746 * The cpu which was handling the broadcast 746 * The cpu which was handling the broadcast
747 * timer marked this cpu in the broadcast 747 * timer marked this cpu in the broadcast
@@ -842,7 +842,7 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
842 842
843 /* Set it up only once ! */ 843 /* Set it up only once ! */
844 if (bc->event_handler != tick_handle_oneshot_broadcast) { 844 if (bc->event_handler != tick_handle_oneshot_broadcast) {
845 int was_periodic = bc->mode == CLOCK_EVT_MODE_PERIODIC; 845 int was_periodic = bc->state == CLOCK_EVT_STATE_PERIODIC;
846 846
847 bc->event_handler = tick_handle_oneshot_broadcast; 847 bc->event_handler = tick_handle_oneshot_broadcast;
848 848
@@ -858,7 +858,7 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
858 tick_broadcast_oneshot_mask, tmpmask); 858 tick_broadcast_oneshot_mask, tmpmask);
859 859
860 if (was_periodic && !cpumask_empty(tmpmask)) { 860 if (was_periodic && !cpumask_empty(tmpmask)) {
861 clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); 861 clockevents_set_state(bc, CLOCK_EVT_STATE_ONESHOT);
862 tick_broadcast_init_next_event(tmpmask, 862 tick_broadcast_init_next_event(tmpmask,
863 tick_next_period); 863 tick_next_period);
864 tick_broadcast_set_event(bc, cpu, tick_next_period, 1); 864 tick_broadcast_set_event(bc, cpu, tick_next_period, 1);