linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wireless, wavelan: spin off by 1
@ 2009-02-25 12:35 Roel Kluin
  2009-02-25 17:24 ` Jean Tourrilhes
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-02-25 12:35 UTC (permalink / raw)
  To: jt; +Cc: linux-wireless, David S. Miller, Andrew Morton

spin can reach -1 after the loop, so 0 is still success.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index de717f8..1565a0a 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -838,9 +838,8 @@ wv_82593_cmd(struct net_device *	dev,
     }
   while(((status & SR3_EXEC_STATE_MASK) != SR3_EXEC_IDLE) && (spin-- > 0));
 
-  /* If the interrupt hasn't be posted */
-  if(spin <= 0)
-    {
+  /* If the interrupt hasn't been posted */
+  if (spin < 0) {
 #ifdef DEBUG_INTERRUPT_ERROR
       printk(KERN_INFO "wv_82593_cmd: %s timeout (previous command), status 0x%02x\n",
 	     str, status);

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

* Re: [PATCH] wireless, wavelan: spin off by 1
  2009-02-25 12:35 [PATCH] wireless, wavelan: spin off by 1 Roel Kluin
@ 2009-02-25 17:24 ` Jean Tourrilhes
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Tourrilhes @ 2009-02-25 17:24 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linux-wireless, David S. Miller, Andrew Morton

On Wed, Feb 25, 2009 at 01:35:34PM +0100, Roel Kluin wrote:
> spin can reach -1 after the loop, so 0 is still success.
> 

	You are probably technically right, but it does not matter in
practice. The chip should answer way faster than this timeout, and we
would loose only 0.1% of the overall timeout value. If the chip answer
was that close to the timeout, because of variation, we would fail
half the time and would need a bigger timeout anyway.
	A better way would be to not test spin, but to test the status
register itself. That way, it's less ambiguous.
	Anyway, such low level code is tricky, and I personally would
not want any change without thourough testing with the hardware. We
know the curent code work, and I don't have time to test, so I would
vote to not change the code.

	Regards,

	Jean


> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
> index de717f8..1565a0a 100644
> --- a/drivers/net/wireless/wavelan_cs.c
> +++ b/drivers/net/wireless/wavelan_cs.c
> @@ -838,9 +838,8 @@ wv_82593_cmd(struct net_device *	dev,
>      }
>    while(((status & SR3_EXEC_STATE_MASK) != SR3_EXEC_IDLE) && (spin-- > 0));
>  
> -  /* If the interrupt hasn't be posted */
> -  if(spin <= 0)
> -    {
> +  /* If the interrupt hasn't been posted */
> +  if (spin < 0) {
>  #ifdef DEBUG_INTERRUPT_ERROR
>        printk(KERN_INFO "wv_82593_cmd: %s timeout (previous command), status 0x%02x\n",
>  	     str, status);

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

end of thread, other threads:[~2009-02-25 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 12:35 [PATCH] wireless, wavelan: spin off by 1 Roel Kluin
2009-02-25 17:24 ` Jean Tourrilhes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).