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

* Re: [KJ] [RFC][PATCH 2/5] char/tpqic02: use poll_event*() interface
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Nishanth Aravamudan @ 2005-03-03 20:32 UTC (permalink / raw)
  To: kernel-janitors

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

On Thu, Mar 03, 2005 at 08:16:54PM +0100, walter harms wrote:
> 
> 
> 
> Nishanth Aravamudan wrote:
> >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;
> 
> 
> hi nish,
> 	the code above looks like:  timeout%=spin_t;

Could be, but one thing at a time :)

> the poll*() looks reasonable. perhaps its better to use functions ?

I used macros so that the @condition could be passed in as a parameter
(not possible, at least easily, with functions, I don't think).

> As user i would like to know WHY the wait terminated, it may be 
> important to know if a signal or timeout occured, are there ways to find 
> out ?

I certainly could change the macros to respond in the same way that
wait_event*() do.

To the list, does that seem like a more reasonable approach?

Thanks,
Nish

[-- 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

* Re: [KJ] [RFC][PATCH 2/5] char/tpqic02: use poll_event*() interface
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Bunk @ 2005-03-05  1:15 UTC (permalink / raw)
  To: kernel-janitors

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

On Thu, Mar 03, 2005 at 10:25:41AM -0800, Nishanth Aravamudan wrote:
> 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
>...

Since at about half a year, this driver is no longer selectable via
Kconfig.

I should resend my patch that removes this driver...

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


[-- 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.