Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

score/time: Migrate to new 'set-state' interface

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>

authored by

Viresh Kumar and committed by
Daniel Lezcano
07d93ebd 07aeed3f

+10 -21
+10 -21
arch/score/kernel/time.c
··· 55 55 return 0; 56 56 } 57 57 58 - static void score_timer_set_mode(enum clock_event_mode mode, 59 - struct clock_event_device *evdev) 58 + static int score_timer_set_periodic(struct clock_event_device *evt) 60 59 { 61 - switch (mode) { 62 - case CLOCK_EVT_MODE_PERIODIC: 63 - outl((TMR_M_PERIODIC | TMR_IE_ENABLE), P_TIMER0_CTRL); 64 - outl(SYSTEM_CLOCK/HZ, P_TIMER0_PRELOAD); 65 - outl(inl(P_TIMER0_CTRL) | TMR_ENABLE, P_TIMER0_CTRL); 66 - break; 67 - case CLOCK_EVT_MODE_ONESHOT: 68 - case CLOCK_EVT_MODE_SHUTDOWN: 69 - case CLOCK_EVT_MODE_RESUME: 70 - case CLOCK_EVT_MODE_UNUSED: 71 - break; 72 - default: 73 - BUG(); 74 - } 60 + outl((TMR_M_PERIODIC | TMR_IE_ENABLE), P_TIMER0_CTRL); 61 + outl(SYSTEM_CLOCK / HZ, P_TIMER0_PRELOAD); 62 + outl(inl(P_TIMER0_CTRL) | TMR_ENABLE, P_TIMER0_CTRL); 63 + return 0; 75 64 } 76 65 77 66 static struct clock_event_device score_clockevent = { 78 - .name = "score_clockevent", 79 - .features = CLOCK_EVT_FEAT_PERIODIC, 80 - .shift = 16, 81 - .set_next_event = score_timer_set_next_event, 82 - .set_mode = score_timer_set_mode, 67 + .name = "score_clockevent", 68 + .features = CLOCK_EVT_FEAT_PERIODIC, 69 + .shift = 16, 70 + .set_next_event = score_timer_set_next_event, 71 + .set_state_periodic = score_timer_set_periodic, 83 72 }; 84 73 85 74 void __init time_init(void)