Skip to contentSkip to conversation

timer fixes

GIT PULL Ingo Molnar 1 participant 1 message Aug 19, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest timers-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus

# HEAD: be5769e2061ac40b32daa83e28e1c4aac7133511 clocksource/drivers/mips-gic-timer: Make gic_clocksource_of_init() return int

Three clocksource driver fixes.

Thanks,

Ingo

------------------>
Arnd Bergmann (1):
clocksource/drivers/kona: Fix get_counter() error handling

Gregory CLEMENT (1):
clocksource/drivers/time-armada-370-xp: Fix the clock reference

Paul Gortmaker (1):
clocksource/drivers/mips-gic-timer: Make gic_clocksource_of_init() return int

 drivers/clocksource/bcm_kona_timer.c     | 16 ++++++++++------
 drivers/clocksource/mips-gic-timer.c     |  2 +-
 drivers/clocksource/time-armada-370-xp.c |  1 -
 3 files changed, 11 insertions(+), 8 deletions(-)
drivers/clocksource/bcm_kona_timer.c +10 -6
index 7e3fd375a627..92f6e4deee74 100644
@@ -66,10 +66,10 @@ static void kona_timer_disable_and_clear(void __iomem *base)
 
 }
 
-static void
+static int
 kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw)
 {
-	int loop_limit = 4;
+	int loop_limit = 3;
 
 	/*
 	 * Read 64-bit free running counter
@@ -83,18 +83,19 @@ kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw)
 	 *      if new hi-word is equal to previously read hi-word then stop.
 	 */
 
-	while (--loop_limit) {
+	do {
 		*msw = readl(timer_base + KONA_GPTIMER_STCHI_OFFSET);
 		*lsw = readl(timer_base + KONA_GPTIMER_STCLO_OFFSET);
 		if (*msw == readl(timer_base + KONA_GPTIMER_STCHI_OFFSET))
 			break;
-	}
+	} while (--loop_limit);
 	if (!loop_limit) {
 		pr_err("bcm_kona_timer: getting counter failed.\n");
 		pr_err(" Timer will be impacted\n");
+		return -ETIMEDOUT;
 	}
 
-	return;
+	return 0;
 }
 
 static int kona_timer_set_next_event(unsigned long clc,
@@ -112,8 +113,11 @@ static int kona_timer_set_next_event(unsigned long clc,
 
 	uint32_t lsw, msw;
 	uint32_t reg;
+	int ret;
 
-	kona_timer_get_counter(timers.tmr_regs, &msw, &lsw);
+	ret = kona_timer_get_counter(timers.tmr_regs, &msw, &lsw);
+	if (ret)
+		return ret;
 
 	/* Load the "next" event tick value */
 	writel(lsw + clc, timers.tmr_regs + KONA_GPTIMER_STCM0_OFFSET);
drivers/clocksource/mips-gic-timer.c +1 -1
index d91e8725917c..b4b3ab5a11ad 100644
@@ -164,7 +164,7 @@ void __init gic_clocksource_init(unsigned int frequency)
 	gic_start_count();
 }
 
-static void __init gic_clocksource_of_init(struct device_node *node)
+static int __init gic_clocksource_of_init(struct device_node *node)
 {
 	struct clk *clk;
 	int ret;
drivers/clocksource/time-armada-370-xp.c +0 -1
index 719b478d136e..3c39e6f45971 100644
@@ -338,7 +338,6 @@ static int __init armada_xp_timer_init(struct device_node *np)
 	struct clk *clk = of_clk_get_by_name(np, "fixed");
 	int ret;
 
-	clk = of_clk_get(np, 0);
 	if (IS_ERR(clk)) {
 		pr_err("Failed to get clock");
 		return PTR_ERR(clk);