X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fasm-generic%2Frtc.h;h=71ef3f0b9685f8adbfcc74a7717b8f7baf2cd496;hb=d26acd92fa990764b72608a68224f46fac377032;hp=dd1bed860e6487a3c325c2dfd66570efe8616066;hpb=d2fc0bacd5c438cb459fdf531eff00ab18422a00;p=linux-2.6 diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h index dd1bed860e..71ef3f0b96 100644 --- a/include/asm-generic/rtc.h +++ b/include/asm-generic/rtc.h @@ -12,11 +12,10 @@ #ifndef __ASM_RTC_H__ #define __ASM_RTC_H__ -#ifdef __KERNEL__ - #include #include #include +#include #define RTC_PIE 0x40 /* periodic interrupt enable */ #define RTC_AIE 0x20 /* alarm interrupt enable */ @@ -45,7 +44,6 @@ static inline unsigned char rtc_is_updating(void) static inline unsigned int get_rtc_time(struct rtc_time *time) { - unsigned long uip_watchdog = jiffies; unsigned char ctrl; unsigned long flags; @@ -55,19 +53,15 @@ static inline unsigned int get_rtc_time(struct rtc_time *time) /* * read RTC once any update in progress is done. The update - * can take just over 2ms. We wait 10 to 20ms. There is no need to + * can take just over 2ms. We wait 20ms. There is no need to * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. * If you need to know *exactly* when a second has started, enable * periodic update complete interrupts, (via ioctl) and then * immediately read /dev/rtc which will block until you get the IRQ. * Once the read clears, read the RTC time (again via ioctl). Easy. */ - - if (rtc_is_updating() != 0) - while (jiffies - uip_watchdog < 2*HZ/100) { - barrier(); - cpu_relax(); - } + if (rtc_is_updating()) + mdelay(20); /* * Only the values that we read from the RTC are set. We leave @@ -213,5 +207,4 @@ static inline int set_rtc_pll(struct rtc_pll_info *pll) return -EINVAL; } -#endif /* __KERNEL__ */ #endif /* __ASM_RTC_H__ */