aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-08-25 14:26:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-25 14:26:56 -0400
commit426e1eafdbd1d1349c852a2b90c7f20879d52ed2 (patch)
tree2c3043d8eef1bf34bf75ce002b380fcf6c5ce380
parentec73adba51b4dae11134f7e6ffc84feade9f15fa (diff)
parent38c052f8cff1bd323ccfa968136a9556652ee420 (diff)
Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: rtc: fix deadlock
-rw-r--r--include/asm-generic/rtc.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index be4af0029ac0..71ef3f0b9685 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -15,6 +15,7 @@
15#include <linux/mc146818rtc.h> 15#include <linux/mc146818rtc.h>
16#include <linux/rtc.h> 16#include <linux/rtc.h>
17#include <linux/bcd.h> 17#include <linux/bcd.h>
18#include <linux/delay.h>
18 19
19#define RTC_PIE 0x40 /* periodic interrupt enable */ 20#define RTC_PIE 0x40 /* periodic interrupt enable */
20#define RTC_AIE 0x20 /* alarm interrupt enable */ 21#define RTC_AIE 0x20 /* alarm interrupt enable */
@@ -43,7 +44,6 @@ static inline unsigned char rtc_is_updating(void)
43 44
44static inline unsigned int get_rtc_time(struct rtc_time *time) 45static inline unsigned int get_rtc_time(struct rtc_time *time)
45{ 46{
46 unsigned long uip_watchdog = jiffies;
47 unsigned char ctrl; 47 unsigned char ctrl;
48 unsigned long flags; 48 unsigned long flags;
49 49
@@ -53,19 +53,15 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
53 53
54 /* 54 /*
55 * read RTC once any update in progress is done. The update 55 * read RTC once any update in progress is done. The update
56 * can take just over 2ms. We wait 10 to 20ms. There is no need to 56 * can take just over 2ms. We wait 20ms. There is no need to
57 * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. 57 * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
58 * If you need to know *exactly* when a second has started, enable 58 * If you need to know *exactly* when a second has started, enable
59 * periodic update complete interrupts, (via ioctl) and then 59 * periodic update complete interrupts, (via ioctl) and then
60 * immediately read /dev/rtc which will block until you get the IRQ. 60 * immediately read /dev/rtc which will block until you get the IRQ.
61 * Once the read clears, read the RTC time (again via ioctl). Easy. 61 * Once the read clears, read the RTC time (again via ioctl). Easy.
62 */ 62 */
63 63 if (rtc_is_updating())
64 if (rtc_is_updating() != 0) 64 mdelay(20);
65 while (jiffies - uip_watchdog < 2*HZ/100) {
66 barrier();
67 cpu_relax();
68 }
69 65
70 /* 66 /*
71 * Only the values that we read from the RTC are set. We leave 67 * Only the values that we read from the RTC are set. We leave