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 64d5ad0b8add..388254f69a2a 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -897,7 +897,7 @@ static unsigned long hpet_rtc_flags;
897static int hpet_prev_update_sec; 897static int hpet_prev_update_sec;
898static struct rtc_time hpet_alarm_time; 898static struct rtc_time hpet_alarm_time;
899static unsigned long hpet_pie_count; 899static unsigned long hpet_pie_count;
900static unsigned long hpet_t1_cmp; 900static u32 hpet_t1_cmp;
901static unsigned long hpet_default_delta; 901static unsigned long hpet_default_delta;
902static unsigned long hpet_pie_delta; 902static unsigned long hpet_pie_delta;
903static unsigned long hpet_pie_limit; 903static unsigned long hpet_pie_limit;
@@ -905,6 +905,14 @@ static unsigned long hpet_pie_limit;
905static rtc_irq_handler irq_handler; 905static rtc_irq_handler irq_handler;
906 906
907/* 907/*
908 * Check that the hpet counter c1 is ahead of the c2
909 */
910static inline int hpet_cnt_ahead(u32 c1, u32 c2)
911{
912 return (s32)(c2 - c1) < 0;
913}
914
915/*
908 * Registers a IRQ handler. 916 * Registers a IRQ handler.
909 */ 917 */
910int hpet_register_irq_handler(rtc_irq_handler handler) 918int hpet_register_irq_handler(rtc_irq_handler handler)
@@ -1075,7 +1083,7 @@ static void hpet_rtc_timer_reinit(void)
1075 hpet_t1_cmp += delta; 1083 hpet_t1_cmp += delta;
1076 hpet_writel(hpet_t1_cmp, HPET_T1_CMP); 1084 hpet_writel(hpet_t1_cmp, HPET_T1_CMP);
1077 lost_ints++; 1085 lost_ints++;
1078 } while ((long)(hpet_readl(HPET_COUNTER) - hpet_t1_cmp) > 0); 1086 } while (!hpet_cnt_ahead(hpet_t1_cmp, hpet_readl(HPET_COUNTER)));
1079 1087
1080 if (lost_ints) { 1088 if (lost_ints) {
1081 if (hpet_rtc_flags & RTC_PIE) 1089 if (hpet_rtc_flags & RTC_PIE)