linux-mips
[Top] [All Lists]

rtc_ds1742_wait

To: linux-mips@linux-mips.org, sjhill@realitydiluted.com
Subject: rtc_ds1742_wait
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Thu, 20 Nov 2003 10:16:11 +0900 (JST)
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
The rtc_ds1742_wait() waits beginning of a next ODD second, though
users of this function expect that it will wait beginning of a next
second.  Here is a patch.

diff -u drivers/char/ds1742.c.org drivers/char/ds1742.c
--- drivers/char/ds1742.c.org   Tue Nov  4 16:57:38 2003
+++ drivers/char/ds1742.c       Thu Nov 20 10:06:05 2003
@@ -251,8 +251,8 @@
 
 void rtc_ds1742_wait(void)
 {
-       while (CMOS_READ(RTC_SECONDS) & 1);
-       while (!(CMOS_READ(RTC_SECONDS) & 1));
+       unsigned char sec = CMOS_READ(RTC_SECONDS);
+       while (!((sec ^ CMOS_READ(RTC_SECONDS)) & 1));
 }
 
 static int ds1742_ioctl(struct inode *inode, struct file *file,
---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>
  • rtc_ds1742_wait, Atsushi Nemoto <=