score/time: Migrate to new 'set-state' interface
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 16 Jul 2015 11:26:27 +0000 (16:56 +0530)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 10 Aug 2015 09:41:04 +0000 (11:41 +0200)
Migrate score driver to the new 'set-state' interface provided by
clockevents core, the earlier 'set-mode' interface is marked obsolete
now.

This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.

We weren't doing anything in ONESHOT/SHUTDOWN/RESUME modes and so
callbacks for them aren't implemented.

Cc: Chen Liqin <liqin.linux@gmail.com>
Cc: Lennox Wu <lennox.wu@gmail.com>
Cc: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
arch/score/kernel/time.c

index 24770cd9b473a51aabcca380ae3f1f3d7ab68e5e..679b8d7b0350a5943532b8274ddd1d3b2c00ab51 100644 (file)
@@ -55,31 +55,20 @@ static int score_timer_set_next_event(unsigned long delta,
        return 0;
 }
 
-static void score_timer_set_mode(enum clock_event_mode mode,
-               struct clock_event_device *evdev)
+static int score_timer_set_periodic(struct clock_event_device *evt)
 {
-       switch (mode) {
-       case CLOCK_EVT_MODE_PERIODIC:
-               outl((TMR_M_PERIODIC | TMR_IE_ENABLE), P_TIMER0_CTRL);
-               outl(SYSTEM_CLOCK/HZ, P_TIMER0_PRELOAD);
-               outl(inl(P_TIMER0_CTRL) | TMR_ENABLE, P_TIMER0_CTRL);
-               break;
-       case CLOCK_EVT_MODE_ONESHOT:
-       case CLOCK_EVT_MODE_SHUTDOWN:
-       case CLOCK_EVT_MODE_RESUME:
-       case CLOCK_EVT_MODE_UNUSED:
-               break;
-       default:
-               BUG();
-       }
+       outl((TMR_M_PERIODIC | TMR_IE_ENABLE), P_TIMER0_CTRL);
+       outl(SYSTEM_CLOCK / HZ, P_TIMER0_PRELOAD);
+       outl(inl(P_TIMER0_CTRL) | TMR_ENABLE, P_TIMER0_CTRL);
+       return 0;
 }
 
 static struct clock_event_device score_clockevent = {
-       .name           = "score_clockevent",
-       .features       = CLOCK_EVT_FEAT_PERIODIC,
-       .shift          = 16,
-       .set_next_event = score_timer_set_next_event,
-       .set_mode       = score_timer_set_mode,
+       .name                   = "score_clockevent",
+       .features               = CLOCK_EVT_FEAT_PERIODIC,
+       .shift                  = 16,
+       .set_next_event         = score_timer_set_next_event,
+       .set_state_periodic     = score_timer_set_periodic,
 };
 
 void __init time_init(void)