diff mbox

drivers/clocksource/fttmr010: Factor clock read code

Message ID 20170613214813.11406-1-linus.walleij@linaro.org
State Superseded
Headers show

Commit Message

Linus Walleij June 13, 2017, 9:48 p.m. UTC
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>

---
Daniel: feel free to apply as-is or squash into the other
patch as you like.
---
 drivers/clocksource/timer-fttmr010.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

-- 
2.9.4

Comments

Daniel Lezcano June 14, 2017, 8:38 a.m. UTC | #1
On 13/06/2017 23:48, Linus Walleij wrote:
> 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>

> ---

> Daniel: feel free to apply as-is or squash into the other

> patch as you like.

> ---

>  drivers/clocksource/timer-fttmr010.c | 16 ++++++----------

>  1 file changed, 6 insertions(+), 10 deletions(-)

Applied thanks!

 -- Daniel

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
diff mbox

Patch

diff --git a/drivers/clocksource/timer-fttmr010.c b/drivers/clocksource/timer-fttmr010.c
index 0074d89cd2ce..bb07787229b6 100644
--- a/drivers/clocksource/timer-fttmr010.c
+++ b/drivers/clocksource/timer-fttmr010.c
@@ -98,30 +98,26 @@  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)
+static unsigned long fttmr010_read_current_timer_up(void)
 {
 	return readl(local_fttmr->base + TIMER2_COUNT);
 }
 
-static u64 notrace fttmr010_read_sched_clock_down(void)
+static unsigned long fttmr010_read_current_timer_down(void)
 {
 	return ~readl(local_fttmr->base + TIMER2_COUNT);
 }
 
-#ifdef CONFIG_ARM
-
-static unsigned long fttmr010_read_current_timer_up(void)
+static u64 notrace fttmr010_read_sched_clock_up(void)
 {
-	return readl(local_fttmr->base + TIMER2_COUNT);
+	return fttmr010_read_current_timer_up();
 }
 
-static unsigned long fttmr010_read_current_timer_down(void)
+static u64 notrace fttmr010_read_sched_clock_down(void)
 {
-	return ~readl(local_fttmr->base + TIMER2_COUNT);
+	return fttmr010_read_current_timer_down();
 }
 
-#endif
-
 static int fttmr010_timer_set_next_event(unsigned long cycles,
 				       struct clock_event_device *evt)
 {