Subject: rtc_ds1742_wait

From: Atsushi Nemoto <[email-masked]>
Date: Thu, 20 Nov 2003 10:16:11 +0900 (JST)

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