If two processes are waiting in rtc_read(), only one will get the data.  The
other will madly spin around theloop in state TASK_RUNNING until another
interrupt happens.

Fix it by resetting TASK_INTERRUPTIBLE _inside_ the retry loop.



 drivers/char/rtc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff -puN drivers/char/rtc.c~rtc-busywait-fix drivers/char/rtc.c
--- 25/drivers/char/rtc.c~rtc-busywait-fix	2003-06-08 03:10:45.000000000 -0700
+++ 25-akpm/drivers/char/rtc.c	2003-06-08 03:11:44.000000000 -0700
@@ -284,12 +284,13 @@ static ssize_t rtc_read(struct file *fil
 
 	add_wait_queue(&rtc_wait, &wait);
 
-	current->state = TASK_INTERRUPTIBLE;
-		
 	do {
 		/* First make it right. Then make it fast. Putting this whole
 		 * block within the parentheses of a while would be too
 		 * confusing. And no, xchg() is not the answer. */
+
+		__set_current_state(TASK_INTERRUPTIBLE);
+		
 		spin_lock_irq (&rtc_lock);
 		data = rtc_irq_data;
 		rtc_irq_data = 0;

_