clocksource/drivers/fttmr010: Factor out clock read code

The sched_clock() and delay timer callbacks can just call
each other and we can save an #ifdef.

Suggested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Andrew Jeffery <andrew@aj.id.au>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
Linus Walleij 2017-06-13 23:48:13 +02:00 committed by Daniel Lezcano
parent 385c98fcc1
commit c477990295
1 changed files with 9 additions and 13 deletions

View File

@ -98,18 +98,6 @@ static inline struct fttmr010 *to_fttmr010(struct clock_event_device *evt)
return container_of(evt, struct fttmr010, clkevt);
}
static u64 notrace fttmr010_read_sched_clock_up(void)
{
return readl(local_fttmr->base + TIMER2_COUNT);
}
static u64 notrace fttmr010_read_sched_clock_down(void)
{
return ~readl(local_fttmr->base + TIMER2_COUNT);
}
#ifdef CONFIG_ARM
static unsigned long fttmr010_read_current_timer_up(void)
{
return readl(local_fttmr->base + TIMER2_COUNT);
@ -120,7 +108,15 @@ static unsigned long fttmr010_read_current_timer_down(void)
return ~readl(local_fttmr->base + TIMER2_COUNT);
}
#endif
static u64 notrace fttmr010_read_sched_clock_up(void)
{
return fttmr010_read_current_timer_up();
}
static u64 notrace fttmr010_read_sched_clock_down(void)
{
return fttmr010_read_current_timer_down();
}
static int fttmr010_timer_set_next_event(unsigned long cycles,
struct clock_event_device *evt)