All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [RFC][PATCH 2/5] char/tpqic02: use poll_event*() interface
@ 2005-03-03 18:25 Nishanth Aravamudan
  2005-03-03 20:32 ` Nishanth Aravamudan
  2005-03-05  1:15 ` Adrian Bunk
  0 siblings, 2 replies; 3+ messages in thread
From: Nishanth Aravamudan @ 2005-03-03 18:25 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1788 bytes --]

Hi,

Description: Use new poll_event*() interface to encapsulate sleep-loops.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

--- 2.6.11-kj-v/drivers/char/tpqic02.c	2005-03-01 23:38:09.000000000 -0800
+++ 2.6.11-kj/drivers/char/tpqic02.c	2005-03-03 10:23:59.000000000 -0800
@@ -527,18 +527,14 @@ static int wait_for_ready(time_t timeout
 		return TE_OK;	/* covers 99.99% of all calls */
 
 	/* Then use schedule() a few times */
-	spin_t = 3;		/* max 0.03 sec busy waiting */
+	spin_t = 3;		/* request max 0.003 sec busy waiting */
 	if (spin_t > timeout)
 		spin_t = timeout;
 	timeout -= spin_t;
 	spin_t += jiffies;
 
 	/* FIXME...*/
-	while (((stat = inb_p(QIC02_STAT_PORT) & QIC02_STAT_MASK) == QIC02_STAT_MASK)  && time_before(jiffies, spin_t))
-	{
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(1);	/* don't waste all the CPU time */
-	}
+	poll_event_timeout(((stat = inb_p(QIC02_STAT_PORT) & QIC02_STAT_MASK) != QIC02_STAT_MASK), 1, spin_t);
 	if ((stat & QIC02_STAT_READY) == 0)
 		return TE_OK;
 
@@ -552,12 +548,8 @@ static int wait_for_ready(time_t timeout
 	TPQDEB({printk("wait_for_ready: additional timeout: %d\n", spin_t);})
 
 	    /* not ready and no exception && timeout not expired yet */
-	while (((stat = inb_p(QIC02_STAT_PORT) & QIC02_STAT_MASK) == QIC02_STAT_MASK) && time_before(jiffies, spin_t)) {
-		/* be `nice` to other processes on long operations... */
-		/* nap 0.30 sec between checks, */
-		/* but could be woken up earlier by signals... */
-		msleep_interruptible(300);
-	}
+	poll_event_interruptible_timeout(((stat = inb_p(QIC02_STAT_PORT) & QIC02_STAT_MASK) != QIC02_STAT_MASK),
+			300, spin_t);
 
 	/* don't use jiffies for this test because it may have changed by now */
 	if ((stat & QIC02_STAT_MASK) == QIC02_STAT_MASK) {

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-05  1:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-03 18:25 [KJ] [RFC][PATCH 2/5] char/tpqic02: use poll_event*() interface Nishanth Aravamudan
2005-03-03 20:32 ` Nishanth Aravamudan
2005-03-05  1:15 ` Adrian Bunk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.