]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
sh: timer: Remove static global variable
authorNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Tue, 20 Aug 2013 05:33:15 +0000 (14:33 +0900)
committerNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Thu, 17 Oct 2013 00:34:39 +0000 (09:34 +0900)
"static u16 bit" is not necessary to use this as static global variable.
This patch fixes this.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
arch/sh/lib/time.c

index 8f83d467920b692d8cce071cfd37b650b02205f7..c554fe8b665a026346731ba428e3ff679432e33b 100644 (file)
 
 static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE;
 
-static u16 bit;
 static unsigned long last_tcnt;
 static unsigned long long overflow_ticks;
 
 unsigned long get_tbclk(void)
 {
-       return get_tmu0_clk_rate() >> ((bit + 1) * 2);
+       u16 tmu_bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1;
+       return get_tmu0_clk_rate() >> ((tmu_bit + 1) * 2);
 }
 
 static inline unsigned long long tick_to_time(unsigned long long tick)
@@ -62,8 +62,8 @@ static void tmu_timer_stop(unsigned int timer)
 
 int timer_init(void)
 {
-       bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1;
-       writew((readw(&tmu->tcr0) & ~TCR_TPSC) | bit, &tmu->tcr0);
+       u16 tmu_bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1;
+       writew((readw(&tmu->tcr0) & ~TCR_TPSC) | tmu_bit, &tmu->tcr0);
 
        tmu_timer_stop(0);
        tmu_timer_start(0);