netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 06/18]  net/cosa: replace  schedule_timeout() with msleep_interruptible()
@ 2004-10-30 22:42 janitor
  2004-10-31 11:08 ` Jeff Garzik
  0 siblings, 1 reply; 4+ messages in thread
From: janitor @ 2004-10-30 22:42 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, janitor, nacc, kas




Any comments would be appreciated. Two patches have been removed from my
set, so the total has been reduced to 38.

Description: Use msleep_interruptible() instead of schedule_timeout()
to guarantee the task delays as expected. Also use set_current_state()
instaed of direct assignment of current->state.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Acked-by: Jan Kasprzak <kas@fi.muni.cz>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>

---

 linux-2.6.10-rc1-max/drivers/net/wan/cosa.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff -puN drivers/net/wan/cosa.c~msleep-drivers_net_wan_cosa drivers/net/wan/cosa.c
--- linux-2.6.10-rc1/drivers/net/wan/cosa.c~msleep-drivers_net_wan_cosa	2004-10-24 17:05:02.000000000 +0200
+++ linux-2.6.10-rc1-max/drivers/net/wan/cosa.c	2004-10-24 17:05:02.000000000 +0200
@@ -543,7 +543,7 @@ static int cosa_probe(int base, int irq,
 		 * FIXME: When this code is not used as module, we should
 		 * probably call udelay() instead of the interruptible sleep.
 		 */
-		current->state = TASK_INTERRUPTIBLE;
+		set_current_state(TASK_INTERRUPTIBLE);
 		cosa_putstatus(cosa, SR_TX_INT_ENA);
 		schedule_timeout(30);
 		irq = probe_irq_off(irqs);
@@ -1564,8 +1564,7 @@ static int cosa_reset_and_read_id(struct
 	cosa_getdata8(cosa);
 	cosa_putstatus(cosa, SR_RST);
 #ifdef MODULE
-	current->state = TASK_INTERRUPTIBLE;
-	schedule_timeout(HZ/2);
+	msleep_interruptible(500);
 #else
 	udelay(5*100000);
 #endif
@@ -1618,7 +1617,7 @@ static int get_wait_data(struct cosa_dat
 			return r;
 		}
 		/* sleep if not ready to read */
-		current->state = TASK_INTERRUPTIBLE;
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout(1);
 	}
 	printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n",
@@ -1645,7 +1644,7 @@ static int put_wait_data(struct cosa_dat
 		}
 #if 0
 		/* sleep if not ready to read */
-		current->state = TASK_INTERRUPTIBLE;
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout(1);
 #endif
 	}
_

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

* Re: [patch 06/18]  net/cosa: replace  schedule_timeout() with msleep_interruptible()
  2004-10-30 22:42 [patch 06/18] net/cosa: replace schedule_timeout() with msleep_interruptible() janitor
@ 2004-10-31 11:08 ` Jeff Garzik
  2004-11-01 11:23   ` Jan Kasprzak
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2004-10-31 11:08 UTC (permalink / raw)
  To: janitor; +Cc: netdev, nacc, kas

janitor@sternwelten.at wrote:
> Any comments would be appreciated. Two patches have been removed from my
> set, so the total has been reduced to 38.
> 
> Description: Use msleep_interruptible() instead of schedule_timeout()
> to guarantee the task delays as expected. Also use set_current_state()
> instaed of direct assignment of current->state.
> 
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> Acked-by: Jan Kasprzak <kas@fi.muni.cz>
> Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
> 
> ---
> 
>  linux-2.6.10-rc1-max/drivers/net/wan/cosa.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff -puN drivers/net/wan/cosa.c~msleep-drivers_net_wan_cosa drivers/net/wan/cosa.c
> --- linux-2.6.10-rc1/drivers/net/wan/cosa.c~msleep-drivers_net_wan_cosa	2004-10-24 17:05:02.000000000 +0200
> +++ linux-2.6.10-rc1-max/drivers/net/wan/cosa.c	2004-10-24 17:05:02.000000000 +0200
> @@ -543,7 +543,7 @@ static int cosa_probe(int base, int irq,
>  		 * FIXME: When this code is not used as module, we should
>  		 * probably call udelay() instead of the interruptible sleep.
>  		 */
> -		current->state = TASK_INTERRUPTIBLE;
> +		set_current_state(TASK_INTERRUPTIBLE);
>  		cosa_putstatus(cosa, SR_TX_INT_ENA);
>  		schedule_timeout(30);
>  		irq = probe_irq_off(irqs);
> @@ -1564,8 +1564,7 @@ static int cosa_reset_and_read_id(struct
>  	cosa_getdata8(cosa);
>  	cosa_putstatus(cosa, SR_RST);
>  #ifdef MODULE
> -	current->state = TASK_INTERRUPTIBLE;
> -	schedule_timeout(HZ/2);
> +	msleep_interruptible(500);
>  #else
>  	udelay(5*100000);
>  #endif
> @@ -1618,7 +1617,7 @@ static int get_wait_data(struct cosa_dat
>  			return r;
>  		}
>  		/* sleep if not ready to read */
> -		current->state = TASK_INTERRUPTIBLE;
> +		set_current_state(TASK_INTERRUPTIBLE);
>  		schedule_timeout(1);
>  	}
>  	printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n",
> @@ -1645,7 +1644,7 @@ static int put_wait_data(struct cosa_dat
>  		}
>  #if 0
>  		/* sleep if not ready to read */
> -		current->state = TASK_INTERRUPTIBLE;
> +		set_current_state(TASK_INTERRUPTIBLE);
>  		schedule_timeout(1);
>  #endif

why add all the memory barriers and such associated with 
set_current_state() ?

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

* Re: [patch 06/18]  net/cosa: replace  schedule_timeout() with msleep_interruptible()
  2004-10-31 11:08 ` Jeff Garzik
@ 2004-11-01 11:23   ` Jan Kasprzak
  2004-11-01 22:00     ` Nishanth Aravamudan
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kasprzak @ 2004-11-01 11:23 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: janitor, netdev, nacc

Jeff Garzik wrote:
: why add all the memory barriers and such associated with 
: set_current_state() ?
: 
	This is not time-critical - COSA is an ISA-only device,
and the driver is not tested on SMP (I have tried to make it SMP-aware,
but at the time I had no SMP machine with ISA slot).

-Yenya

-- 
| Jan "Yenya" Kasprzak  <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839      Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/   Czech Linux Homepage: http://www.linux.cz/ |
> Whatever the Java applications and desktop dances may lead to, Unix will <
> still be pushing the packets around for a quite a while.      --Rob Pike <

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

* Re: [patch 06/18]  net/cosa: replace  schedule_timeout() with msleep_interruptible()
  2004-11-01 11:23   ` Jan Kasprzak
@ 2004-11-01 22:00     ` Nishanth Aravamudan
  0 siblings, 0 replies; 4+ messages in thread
From: Nishanth Aravamudan @ 2004-11-01 22:00 UTC (permalink / raw)
  To: Jan Kasprzak; +Cc: Jeff Garzik, janitor, netdev

On Mon, Nov 01, 2004 at 12:23:14PM +0100, Jan Kasprzak wrote:
> Jeff Garzik wrote:
> : why add all the memory barriers and such associated with 
> : set_current_state() ?
> : 
> 	This is not time-critical - COSA is an ISA-only device,
> and the driver is not tested on SMP (I have tried to make it SMP-aware,
> but at the time I had no SMP machine with ISA slot).

Just to make it clear, then, the current patch is ok? Or would you
prefer I had used __set_current_state()?

-Nish

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

end of thread, other threads:[~2004-11-01 22:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-30 22:42 [patch 06/18] net/cosa: replace schedule_timeout() with msleep_interruptible() janitor
2004-10-31 11:08 ` Jeff Garzik
2004-11-01 11:23   ` Jan Kasprzak
2004-11-01 22:00     ` Nishanth Aravamudan

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