aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/hpet.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/hpet.c')
-rw-r--r--arch/x86/kernel/hpet.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 5c8da2c2c185..a00545fe5cdd 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -899,7 +899,7 @@ static unsigned long hpet_rtc_flags;
899static int hpet_prev_update_sec; 899static int hpet_prev_update_sec;
900static struct rtc_time hpet_alarm_time; 900static struct rtc_time hpet_alarm_time;
901static unsigned long hpet_pie_count; 901static unsigned long hpet_pie_count;
902static unsigned long hpet_t1_cmp; 902static u32 hpet_t1_cmp;
903static unsigned long hpet_default_delta; 903static unsigned long hpet_default_delta;
904static unsigned long hpet_pie_delta; 904static unsigned long hpet_pie_delta;
905static unsigned long hpet_pie_limit; 905static unsigned long hpet_pie_limit;
@@ -907,6 +907,14 @@ static unsigned long hpet_pie_limit;
907static rtc_irq_handler irq_handler; 907static rtc_irq_handler irq_handler;
908 908
909/* 909/*
910 * Check that the hpet counter c1 is ahead of the c2
911 */
912static inline int hpet_cnt_ahead(u32 c1, u32 c2)
913{
914 return (s32)(c2 - c1) < 0;
915}
916
917/*
910 * Registers a IRQ handler. 918 * Registers a IRQ handler.
911 */ 919 */
912int hpet_register_irq_handler(rtc_irq_handler handler) 920int hpet_register_irq_handler(rtc_irq_handler handler)
@@ -1077,7 +1085,7 @@ static void hpet_rtc_timer_reinit(void)
1077 hpet_t1_cmp += delta; 1085 hpet_t1_cmp += delta;
1078 hpet_writel(hpet_t1_cmp, HPET_T1_CMP); 1086 hpet_writel(hpet_t1_cmp, HPET_T1_CMP);
1079 lost_ints++; 1087 lost_ints++;
1080 } while ((long)(hpet_readl(HPET_COUNTER) - hpet_t1_cmp) > 0); 1088 } while (!hpet_cnt_ahead(hpet_t1_cmp, hpet_readl(HPET_COUNTER)));
1081 1089
1082 if (lost_ints) { 1090 if (lost_ints) {
1083 if (hpet_rtc_flags & RTC_PIE) 1091 if (hpet_rtc_flags & RTC_PIE)