rtc: fix reported IRQ rate for when HPET is enabled
authorPaul Gortmaker <[email protected]>
Fri, 11 Jul 2008 00:30:48 +0000 (17:30 -0700)
committerLinus Torvalds <[email protected]>
Fri, 11 Jul 2008 01:04:43 +0000 (18:04 -0700)
The IRQ rate reported back by the RTC is incorrect when HPET is enabled.

Newer hardware that has HPET to emulate the legacy RTC device gets this value
wrong since after it sets the rate, it returns before setting the variable
used to report the IRQ rate back to users of the device -- so the set rate and
the reported rate get out of sync.

Signed-off-by: Paul Gortmaker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: David Brownell <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/char/rtc.c

index 5f80a9dff5735103b91cc16c40338aafa96f853a..909cac93fa2ad408caf695e253a4a4820cef659e 100644 (file)
@@ -678,12 +678,13 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
                if (arg != (1<<tmp))
                        return -EINVAL;
 
+               rtc_freq = arg;
+
                spin_lock_irqsave(&rtc_lock, flags);
                if (hpet_set_periodic_freq(arg)) {
                        spin_unlock_irqrestore(&rtc_lock, flags);
                        return 0;
                }
-               rtc_freq = arg;
 
                val = CMOS_READ(RTC_FREQ_SELECT) & 0xf0;
                val |= (16 - tmp);