netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: janitor@sternwelten.at
Cc: netdev@oss.sgi.com, nacc@us.ibm.com
Subject: Re: [patch 15/18]  net/ibmtr: replace 	schedule_timeout() with msleep()/msleep_interruptible()
Date: Sun, 31 Oct 2004 06:03:07 -0500	[thread overview]
Message-ID: <4184C66B.8040501@pobox.com> (raw)
In-Reply-To: <E1CO1wB-0002eM-If@sputnik>

janitor@sternwelten.at wrote:
> Any comments would be appreciated.
> 
> Description: Use msleep() / msleep_interruptible() [as appropriate]
> instead of schedule_timeout() to guarantee the task delays as expected.
> 
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
> 
> ---
> 
>  linux-2.6.10-rc1-max/drivers/net/tokenring/ibmtr.c |   11 +++++------
>  1 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff -puN drivers/net/tokenring/ibmtr.c~msleep+msleep_interruptible-drivers_net_tokenring_ibmtr drivers/net/tokenring/ibmtr.c
> --- linux-2.6.10-rc1/drivers/net/tokenring/ibmtr.c~msleep+msleep_interruptible-drivers_net_tokenring_ibmtr	2004-10-24 17:05:34.000000000 +0200
> +++ linux-2.6.10-rc1-max/drivers/net/tokenring/ibmtr.c	2004-10-24 17:05:34.000000000 +0200
> @@ -108,6 +108,7 @@ in the event that chatty debug messages 
>  #define IBMTR_DEBUG_MESSAGES 0
>  
>  #include <linux/module.h>
> +#include <linux/delay.h>
>  
>  #ifdef PCMCIA		/* required for ibmtr_cs.c to build */
>  #undef MODULE		/* yes, really */
> @@ -317,7 +318,7 @@ static void ibmtr_cleanup_card(struct ne
>  	if (dev->base_addr) {
>  		outb(0,dev->base_addr+ADAPTRESET);
>  		
> -		schedule_timeout(TR_RST_TIME); /* wait 50ms */
> +		msleep(jiffies_to_msecs(TR_RST_TIME)); /* wait 50ms */
>  
>  		outb(0,dev->base_addr+ADAPTRESETREL);
>  	}
> @@ -858,8 +859,7 @@ static int tok_init_card(struct net_devi
>  	writeb(~INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN);
>  	outb(0, PIOaddr + ADAPTRESET);
>  
> -	current->state=TASK_UNINTERRUPTIBLE;
> -	schedule_timeout(TR_RST_TIME); /* wait 50ms */
> +	msleep(jiffies_to_msecs(TR_RST_TIME));		/* wait 50ms */
>  
>  	outb(0, PIOaddr + ADAPTRESETREL);
>  #ifdef ENABLE_PAGING
> @@ -912,9 +912,8 @@ static int tok_open(struct net_device *d
>  			DPRINTK("Adapter is up and running\n");
>  			return 0;
>  		}
> -		current->state=TASK_INTERRUPTIBLE;
> -		i=schedule_timeout(TR_RETRY_INTERVAL); /* wait 30 seconds */
> -		if(i!=0) break; /*prob. a signal, like the i>24*HZ case above */
> +		if(msleep_interruptible(jiffies_to_msecs(TR_RETRY_INTERVAL)))
> +			break; /*prob. a signal, like the i>24*HZ case above */
>  	}
>  	outb(0, dev->base_addr + ADAPTRESET);/* kill pending interrupts*/
>  	DPRINTK("TERMINATED via signal\n");	/*BMS useful */

It makes more sense to convert the constants to msecs in the source 
code, instead of converting them at runtime.

	Jeff

  reply	other threads:[~2004-10-31 11:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-30 22:43 [patch 15/18] net/ibmtr: replace schedule_timeout() with msleep()/msleep_interruptible() janitor
2004-10-31 11:03 ` Jeff Garzik [this message]
2004-11-01 19:22   ` [PATCH] linux/ibmtr.h: add constants for appropriate delays Nishanth Aravamudan
2004-11-01 19:27   ` [PATCH] net/ibmtr: replace schedule_timeout() with msleep()/msleep_interruptible() Nishanth Aravamudan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4184C66B.8040501@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=janitor@sternwelten.at \
    --cc=nacc@us.ibm.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).