diff options
Diffstat (limited to 'arch/m32r/kernel/time.c')
-rw-r--r-- | arch/m32r/kernel/time.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c index ba61c4c73202..9cedcef11575 100644 --- a/arch/m32r/kernel/time.c +++ b/arch/m32r/kernel/time.c | |||
@@ -33,6 +33,15 @@ | |||
33 | 33 | ||
34 | #include <asm/hw_irq.h> | 34 | #include <asm/hw_irq.h> |
35 | 35 | ||
36 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) | ||
37 | /* this needs a better home */ | ||
38 | DEFINE_SPINLOCK(rtc_lock); | ||
39 | |||
40 | #ifdef CONFIG_RTC_DRV_CMOS_MODULE | ||
41 | EXPORT_SYMBOL(rtc_lock); | ||
42 | #endif | ||
43 | #endif /* pc-style 'CMOS' RTC support */ | ||
44 | |||
36 | #ifdef CONFIG_SMP | 45 | #ifdef CONFIG_SMP |
37 | extern void smp_local_timer_interrupt(void); | 46 | extern void smp_local_timer_interrupt(void); |
38 | #endif | 47 | #endif |
@@ -66,7 +75,7 @@ u32 arch_gettimeoffset(void) | |||
66 | count = 0; | 75 | count = 0; |
67 | 76 | ||
68 | count = (latch - count) * TICK_SIZE; | 77 | count = (latch - count) * TICK_SIZE; |
69 | elapsed_time = (count + latch / 2) / latch; | 78 | elapsed_time = DIV_ROUND_CLOSEST(count, latch); |
70 | /* NOTE: LATCH is equal to the "interval" value (= reload count). */ | 79 | /* NOTE: LATCH is equal to the "interval" value (= reload count). */ |
71 | 80 | ||
72 | #else /* CONFIG_SMP */ | 81 | #else /* CONFIG_SMP */ |
@@ -84,7 +93,7 @@ u32 arch_gettimeoffset(void) | |||
84 | p_count = count; | 93 | p_count = count; |
85 | 94 | ||
86 | count = (latch - count) * TICK_SIZE; | 95 | count = (latch - count) * TICK_SIZE; |
87 | elapsed_time = (count + latch / 2) / latch; | 96 | elapsed_time = DIV_ROUND_CLOSEST(count, latch); |
88 | /* NOTE: LATCH is equal to the "interval" value (= reload count). */ | 97 | /* NOTE: LATCH is equal to the "interval" value (= reload count). */ |
89 | #endif /* CONFIG_SMP */ | 98 | #endif /* CONFIG_SMP */ |
90 | #elif defined(CONFIG_CHIP_M32310) | 99 | #elif defined(CONFIG_CHIP_M32310) |
@@ -202,7 +211,7 @@ void __init time_init(void) | |||
202 | 211 | ||
203 | bus_clock = boot_cpu_data.bus_clock; | 212 | bus_clock = boot_cpu_data.bus_clock; |
204 | divide = boot_cpu_data.timer_divide; | 213 | divide = boot_cpu_data.timer_divide; |
205 | latch = (bus_clock/divide + HZ / 2) / HZ; | 214 | latch = DIV_ROUND_CLOSEST(bus_clock/divide, HZ); |
206 | 215 | ||
207 | printk("Timer start : latch = %ld\n", latch); | 216 | printk("Timer start : latch = %ld\n", latch); |
208 | 217 | ||