rtc-cmos: avoid spurious irqs
This fixes kernel http://bugzilla.kernel.org/show_bug.cgi?id=11112 (bogus RTC update IRQs reported) for rtc-cmos, in two ways: - When HPET is stealing the IRQs, use the first IRQ to grab the seconds counter which will be monitored (instead of using whatever was previously in that memory); - In sane IRQ handling modes, scrub out old IRQ status before enabling IRQs. That latter is done by tightening up IRQ handling for rtc-cmos everywhere, also ensuring that when HPET is used it's the only thing triggering IRQ reports to userspace; net object shrink. Also fix a bogus HPET message related to its RTC emulation. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Report-by: W Unruh <unruh@physics.ubc.ca> Cc: Andrew Victor <avictor.za@gmail.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
449321b39f
commit
7e2a31da85
@ -468,7 +468,7 @@ void hpet_disable(void)
|
||||
#define RTC_NUM_INTS 1
|
||||
|
||||
static unsigned long hpet_rtc_flags;
|
||||
static unsigned long hpet_prev_update_sec;
|
||||
static int hpet_prev_update_sec;
|
||||
static struct rtc_time hpet_alarm_time;
|
||||
static unsigned long hpet_pie_count;
|
||||
static unsigned long hpet_t1_cmp;
|
||||
@ -575,6 +575,9 @@ int hpet_set_rtc_irq_bit(unsigned long bit_mask)
|
||||
|
||||
hpet_rtc_flags |= bit_mask;
|
||||
|
||||
if ((bit_mask & RTC_UIE) && !(oldbits & RTC_UIE))
|
||||
hpet_prev_update_sec = -1;
|
||||
|
||||
if (!oldbits)
|
||||
hpet_rtc_timer_init();
|
||||
|
||||
@ -652,7 +655,7 @@ static void hpet_rtc_timer_reinit(void)
|
||||
if (hpet_rtc_flags & RTC_PIE)
|
||||
hpet_pie_count += lost_ints;
|
||||
if (printk_ratelimit())
|
||||
printk(KERN_WARNING "rtc: lost %d interrupts\n",
|
||||
printk(KERN_WARNING "hpet1: lost %d rtc interrupts\n",
|
||||
lost_ints);
|
||||
}
|
||||
}
|
||||
@ -670,7 +673,8 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
|
||||
|
||||
if (hpet_rtc_flags & RTC_UIE &&
|
||||
curr_time.tm_sec != hpet_prev_update_sec) {
|
||||
rtc_int_flag = RTC_UF;
|
||||
if (hpet_prev_update_sec >= 0)
|
||||
rtc_int_flag = RTC_UF;
|
||||
hpet_prev_update_sec = curr_time.tm_sec;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user