]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
clocksource/drivers/tango-xtal: Replace code by clocksource_mmio_init
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Fri, 13 Nov 2015 09:44:38 +0000 (10:44 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 15 Dec 2015 09:12:17 +0000 (10:12 +0100)
The current code to initialize, register and read the clocksource is
already factored out in mmio.c via the clocksource_mmio_init function.

Factor out the code with the clocksource_mmio_init function.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/clocksource/Kconfig
drivers/clocksource/tango_xtal.c

index db240cb56da786e7d244f4fae8e15e6f8db48669..b251013eef0a952f28e3c3464e0876773bd9ddab 100644 (file)
@@ -351,6 +351,7 @@ config CLKSRC_TANGO_XTAL
        bool "Clocksource for Tango SoC" if COMPILE_TEST
        depends on ARM
        select CLKSRC_OF
+       select CLKSRC_MMIO
        help
          This enables the clocksource for Tango SoC
 
index d297b30d2bc03cb5f19e195fdf18d765b4b6a3e9..2bcecafdeaeac76b2e4decf3dda66d8d7a6f027b 100644 (file)
@@ -19,19 +19,6 @@ static u64 notrace read_sched_clock(void)
        return read_xtal_counter();
 }
 
-static cycle_t read_clocksource(struct clocksource *cs)
-{
-       return read_xtal_counter();
-}
-
-static struct clocksource tango_xtal = {
-       .name   = "tango-xtal",
-       .rating = 350,
-       .read   = read_clocksource,
-       .mask   = CLOCKSOURCE_MASK(32),
-       .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static void __init tango_clocksource_init(struct device_node *np)
 {
        struct clk *clk;
@@ -53,8 +40,9 @@ static void __init tango_clocksource_init(struct device_node *np)
        delay_timer.freq = xtal_freq;
        delay_timer.read_current_timer = read_xtal_counter;
 
-       ret = clocksource_register_hz(&tango_xtal, xtal_freq);
-       if (ret != 0) {
+       ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350,
+                                   32, clocksource_mmio_readl_up);
+       if (!ret) {
                pr_err("%s: registration failed\n", np->full_name);
                return;
        }