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.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index cd759ad90690..388254f69a2a 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -628,11 +628,12 @@ static int hpet_cpuhp_notify(struct notifier_block *n,
628 628
629 switch (action & 0xf) { 629 switch (action & 0xf) {
630 case CPU_ONLINE: 630 case CPU_ONLINE:
631 INIT_DELAYED_WORK(&work.work, hpet_work); 631 INIT_DELAYED_WORK_ON_STACK(&work.work, hpet_work);
632 init_completion(&work.complete); 632 init_completion(&work.complete);
633 /* FIXME: add schedule_work_on() */ 633 /* FIXME: add schedule_work_on() */
634 schedule_delayed_work_on(cpu, &work.work, 0); 634 schedule_delayed_work_on(cpu, &work.work, 0);
635 wait_for_completion(&work.complete); 635 wait_for_completion(&work.complete);
636 destroy_timer_on_stack(&work.work.timer);
636 break; 637 break;
637 case CPU_DEAD: 638 case CPU_DEAD:
638 if (hdev) { 639 if (hdev) {
@@ -896,7 +897,7 @@ static unsigned long hpet_rtc_flags;
896static int hpet_prev_update_sec; 897static int hpet_prev_update_sec;
897static struct rtc_time hpet_alarm_time; 898static struct rtc_time hpet_alarm_time;
898static unsigned long hpet_pie_count; 899static unsigned long hpet_pie_count;
899static unsigned long hpet_t1_cmp; 900static u32 hpet_t1_cmp;
900static unsigned long hpet_default_delta; 901static unsigned long hpet_default_delta;
901static unsigned long hpet_pie_delta; 902static unsigned long hpet_pie_delta;
902static unsigned long hpet_pie_limit; 903static unsigned long hpet_pie_limit;
@@ -904,6 +905,14 @@ static unsigned long hpet_pie_limit;
904static rtc_irq_handler irq_handler; 905static rtc_irq_handler irq_handler;
905 906
906/* 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/*
907 * Registers a IRQ handler. 916 * Registers a IRQ handler.
908 */ 917 */
909int hpet_register_irq_handler(rtc_irq_handler handler) 918int hpet_register_irq_handler(rtc_irq_handler handler)
@@ -1074,7 +1083,7 @@ static void hpet_rtc_timer_reinit(void)
1074 hpet_t1_cmp += delta; 1083 hpet_t1_cmp += delta;
1075 hpet_writel(hpet_t1_cmp, HPET_T1_CMP); 1084 hpet_writel(hpet_t1_cmp, HPET_T1_CMP);
1076 lost_ints++; 1085 lost_ints++;
1077 } while ((long)(hpet_readl(HPET_COUNTER) - hpet_t1_cmp) > 0); 1086 } while (!hpet_cnt_ahead(hpet_t1_cmp, hpet_readl(HPET_COUNTER)));
1078 1087
1079 if (lost_ints) { 1088 if (lost_ints) {
1080 if (hpet_rtc_flags & RTC_PIE) 1089 if (hpet_rtc_flags & RTC_PIE)