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

clockevents/drivers/pxa: Migrate to new 'set-state' interface

Migrate pxa 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.

Both oneshot and shutdown modes had exactly same code and so only a
single callback is sufficient now, which will be called for both the
modes.

Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>

authored by

Viresh Kumar and committed by
Daniel Lezcano
47d490ea 9b0af699

+13 -26
+13 -26
drivers/clocksource/pxa_timer.c
··· 88 88 return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; 89 89 } 90 90 91 - static void 92 - pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev) 91 + static int pxa_osmr0_shutdown(struct clock_event_device *evt) 93 92 { 94 - switch (mode) { 95 - case CLOCK_EVT_MODE_ONESHOT: 96 - timer_writel(timer_readl(OIER) & ~OIER_E0, OIER); 97 - timer_writel(OSSR_M0, OSSR); 98 - break; 99 - 100 - case CLOCK_EVT_MODE_UNUSED: 101 - case CLOCK_EVT_MODE_SHUTDOWN: 102 - /* initializing, released, or preparing for suspend */ 103 - timer_writel(timer_readl(OIER) & ~OIER_E0, OIER); 104 - timer_writel(OSSR_M0, OSSR); 105 - break; 106 - 107 - case CLOCK_EVT_MODE_RESUME: 108 - case CLOCK_EVT_MODE_PERIODIC: 109 - break; 110 - } 93 + /* initializing, released, or preparing for suspend */ 94 + timer_writel(timer_readl(OIER) & ~OIER_E0, OIER); 95 + timer_writel(OSSR_M0, OSSR); 96 + return 0; 111 97 } 112 98 113 99 #ifdef CONFIG_PM ··· 133 147 #endif 134 148 135 149 static struct clock_event_device ckevt_pxa_osmr0 = { 136 - .name = "osmr0", 137 - .features = CLOCK_EVT_FEAT_ONESHOT, 138 - .rating = 200, 139 - .set_next_event = pxa_osmr0_set_next_event, 140 - .set_mode = pxa_osmr0_set_mode, 141 - .suspend = pxa_timer_suspend, 142 - .resume = pxa_timer_resume, 150 + .name = "osmr0", 151 + .features = CLOCK_EVT_FEAT_ONESHOT, 152 + .rating = 200, 153 + .set_next_event = pxa_osmr0_set_next_event, 154 + .set_state_shutdown = pxa_osmr0_shutdown, 155 + .set_state_oneshot = pxa_osmr0_shutdown, 156 + .suspend = pxa_timer_suspend, 157 + .resume = pxa_timer_resume, 143 158 }; 144 159 145 160 static struct irqaction pxa_ost0_irq = {