summaryrefslogtreecommitdiff
path: root/drivers/clocksource/sunxi_timer.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2013-01-12 11:50:06 +0000
committerOlof Johansson <olof@lixom.net>2013-01-14 10:12:42 -0800
commit77cc982f6a3b33a5aa058ad3b20cda8866db2948 (patch)
treef9a4078925354e51becd8167e6c006e99ff27b11 /drivers/clocksource/sunxi_timer.c
parent838a2ae80a6ab52139fb1bf0a93ea8c5eff94488 (diff)
clocksource: use clockevents_config_and_register() where possible
The clockevent core is able to figure out the best mult and shift, calculate min_delta_ns and max_delta_ns, with the necessary info passed into clockevents_config_and_register(). Use this combined configure and register function where possible to make the codes less error prone and gain some positive diff stat. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: Andres Salomon <dilinger@queued.net> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/clocksource/sunxi_timer.c')
-rw-r--r--drivers/clocksource/sunxi_timer.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/clocksource/sunxi_timer.c b/drivers/clocksource/sunxi_timer.c
index 3cd1bd3d7aee..f9118664e440 100644
--- a/drivers/clocksource/sunxi_timer.c
+++ b/drivers/clocksource/sunxi_timer.c
@@ -74,7 +74,6 @@ static int sunxi_clkevt_next_event(unsigned long evt,
static struct clock_event_device sunxi_clockevent = {
.name = "sunxi_tick",
- .shift = 32,
.rating = 300,
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
.set_mode = sunxi_clkevt_mode,
@@ -154,16 +153,10 @@ static void __init sunxi_timer_init(void)
val = readl(timer_base + TIMER_CTL_REG);
writel(val | TIMER_CTL_ENABLE, timer_base + TIMER_CTL_REG);
- sunxi_clockevent.mult = div_sc(rate / TIMER_SCAL,
- NSEC_PER_SEC,
- sunxi_clockevent.shift);
- sunxi_clockevent.max_delta_ns = clockevent_delta2ns(0xff,
- &sunxi_clockevent);
- sunxi_clockevent.min_delta_ns = clockevent_delta2ns(0x1,
- &sunxi_clockevent);
sunxi_clockevent.cpumask = cpumask_of(0);
- clockevents_register_device(&sunxi_clockevent);
+ clockevents_config_and_register(&sunxi_clockevent, rate / TIMER_SCAL,
+ 0x1, 0xff);
}
struct sys_timer sunxi_timer = {