All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@oss.sgi.com, kernel-janitors@lists.osdl.org
Subject: [KJ] [PATCH] net/gt96100eth: replace gt96100_delay() with
Date: Mon, 01 Nov 2004 18:17:01 +0000	[thread overview]
Message-ID: <20041101190841.GB1730@us.ibm.com> (raw)
In-Reply-To: <4184C72F.8000905@pobox.com>

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

On Sun, Oct 31, 2004 at 06:06:23AM -0500, Jeff Garzik wrote:
> janitor@sternwelten.at wrote:
> >@@ -528,7 +517,7 @@ abort(struct net_device *dev, u32 abort_
> > 	// wait for abort to complete
> > 	while (GT96100ETH_READ(gp, GT96100_ETH_SDMA_COMM) & abort_bits) {
> > 		// snooze for 20 msec and check again
> >-		gt96100_delay(1);
> >+		msleep_interruptible(20);
> > 	
> > 		if (--timedout == 0) {
> 
> 
> don't change the behavior of the driver, even if it disagrees with the 
> comment.

Ok, please find the corrected patch below.

Description: Uses msleep_interruptible() instead of gt96100_delay()
to guarantee the task delays as expected. Removes prototype and
definition of now unused gt96100_delay() function. Corrects one comment
to correspond to the code.

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


--- 2.6.10-rc1-vanilla/drivers/net/gt96100eth.c	2004-10-30 15:33:30.000000000 -0700
+++ 2.6.10-rc1/drivers/net/gt96100eth.c	2004-11-01 11:05:37.000000000 -0800
@@ -59,7 +59,6 @@
 // prototypes
 static void* dmaalloc(size_t size, dma_addr_t *dma_handle);
 static void dmafree(size_t size, void *vaddr);
-static void gt96100_delay(int msec);
 static int gt96100_add_hash_entry(struct net_device *dev,
 				  unsigned char* addr);
 static void read_mib_counters(struct gt96100_private *gp);
@@ -183,16 +182,6 @@ static void dmafree(size_t size, void *v
 	free_pages((unsigned long)vaddr, get_order(size));
 }
 
-static void gt96100_delay(int ms)
-{
-	if (in_interrupt())
-		return;
-	else {
-		current->state = TASK_INTERRUPTIBLE;
-		schedule_timeout(ms*HZ/1000);
-	}
-}
-
 static int
 parse_mac_addr(struct net_device *dev, char* macstr)
 {
@@ -238,7 +227,7 @@ read_MII(int phy_addr, u32 reg)
 	// wait for last operation to complete
 	while (GT96100_READ(GT96100_ETH_SMI_REG) & smirBusy) {
 		// snooze for 1 msec and check again
-		gt96100_delay(1);
+		msleep_interruptible(1);
 
 		if (--timedout == 0) {
 			printk(KERN_ERR "%s: busy timeout!!\n", __FUNCTION__);
@@ -252,7 +241,7 @@ read_MII(int phy_addr, u32 reg)
 	// wait for read to complete
 	while (!((smir = GT96100_READ(GT96100_ETH_SMI_REG)) & smirReadValid)) {
 		// snooze for 1 msec and check again
-		gt96100_delay(1);
+		msleep_interruptible(1);
 	
 		if (--timedout == 0) {
 			printk(KERN_ERR "%s: timeout!!\n", __FUNCTION__);
@@ -304,7 +293,7 @@ write_MII(int phy_addr, u32 reg, u16 dat
 	// wait for last operation to complete
 	while (GT96100_READ(GT96100_ETH_SMI_REG) & smirBusy) {
 		// snooze for 1 msec and check again
-		gt96100_delay(1);
+		msleep_interruptible(1);
 	
 		if (--timedout == 0) {
 			printk(KERN_ERR "%s: busy timeout!!\n", __FUNCTION__);
@@ -527,8 +516,8 @@ abort(struct net_device *dev, u32 abort_
 
 	// wait for abort to complete
 	while (GT96100ETH_READ(gp, GT96100_ETH_SDMA_COMM) & abort_bits) {
-		// snooze for 20 msec and check again
-		gt96100_delay(1);
+		// snooze for 1 msec and check again
+		msleep_interruptible(1);
 	
 		if (--timedout == 0) {
 			err("%s: timeout!!\n", __FUNCTION__);

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

WARNING: multiple messages have this Message-ID (diff)
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@oss.sgi.com, kernel-janitors@lists.osdl.org
Subject: [PATCH]  net/gt96100eth: replace gt96100_delay() with msleep_interruptible()
Date: Mon, 1 Nov 2004 11:08:41 -0800	[thread overview]
Message-ID: <20041101190841.GB1730@us.ibm.com> (raw)
In-Reply-To: <4184C72F.8000905@pobox.com>

On Sun, Oct 31, 2004 at 06:06:23AM -0500, Jeff Garzik wrote:
> janitor@sternwelten.at wrote:
> >@@ -528,7 +517,7 @@ abort(struct net_device *dev, u32 abort_
> > 	// wait for abort to complete
> > 	while (GT96100ETH_READ(gp, GT96100_ETH_SDMA_COMM) & abort_bits) {
> > 		// snooze for 20 msec and check again
> >-		gt96100_delay(1);
> >+		msleep_interruptible(20);
> > 	
> > 		if (--timedout == 0) {
> 
> 
> don't change the behavior of the driver, even if it disagrees with the 
> comment.

Ok, please find the corrected patch below.

Description: Uses msleep_interruptible() instead of gt96100_delay()
to guarantee the task delays as expected. Removes prototype and
definition of now unused gt96100_delay() function. Corrects one comment
to correspond to the code.

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


--- 2.6.10-rc1-vanilla/drivers/net/gt96100eth.c	2004-10-30 15:33:30.000000000 -0700
+++ 2.6.10-rc1/drivers/net/gt96100eth.c	2004-11-01 11:05:37.000000000 -0800
@@ -59,7 +59,6 @@
 // prototypes
 static void* dmaalloc(size_t size, dma_addr_t *dma_handle);
 static void dmafree(size_t size, void *vaddr);
-static void gt96100_delay(int msec);
 static int gt96100_add_hash_entry(struct net_device *dev,
 				  unsigned char* addr);
 static void read_mib_counters(struct gt96100_private *gp);
@@ -183,16 +182,6 @@ static void dmafree(size_t size, void *v
 	free_pages((unsigned long)vaddr, get_order(size));
 }
 
-static void gt96100_delay(int ms)
-{
-	if (in_interrupt())
-		return;
-	else {
-		current->state = TASK_INTERRUPTIBLE;
-		schedule_timeout(ms*HZ/1000);
-	}
-}
-
 static int
 parse_mac_addr(struct net_device *dev, char* macstr)
 {
@@ -238,7 +227,7 @@ read_MII(int phy_addr, u32 reg)
 	// wait for last operation to complete
 	while (GT96100_READ(GT96100_ETH_SMI_REG) & smirBusy) {
 		// snooze for 1 msec and check again
-		gt96100_delay(1);
+		msleep_interruptible(1);
 
 		if (--timedout == 0) {
 			printk(KERN_ERR "%s: busy timeout!!\n", __FUNCTION__);
@@ -252,7 +241,7 @@ read_MII(int phy_addr, u32 reg)
 	// wait for read to complete
 	while (!((smir = GT96100_READ(GT96100_ETH_SMI_REG)) & smirReadValid)) {
 		// snooze for 1 msec and check again
-		gt96100_delay(1);
+		msleep_interruptible(1);
 	
 		if (--timedout == 0) {
 			printk(KERN_ERR "%s: timeout!!\n", __FUNCTION__);
@@ -304,7 +293,7 @@ write_MII(int phy_addr, u32 reg, u16 dat
 	// wait for last operation to complete
 	while (GT96100_READ(GT96100_ETH_SMI_REG) & smirBusy) {
 		// snooze for 1 msec and check again
-		gt96100_delay(1);
+		msleep_interruptible(1);
 	
 		if (--timedout == 0) {
 			printk(KERN_ERR "%s: busy timeout!!\n", __FUNCTION__);
@@ -527,8 +516,8 @@ abort(struct net_device *dev, u32 abort_
 
 	// wait for abort to complete
 	while (GT96100ETH_READ(gp, GT96100_ETH_SDMA_COMM) & abort_bits) {
-		// snooze for 20 msec and check again
-		gt96100_delay(1);
+		// snooze for 1 msec and check again
+		msleep_interruptible(1);
 	
 		if (--timedout == 0) {
 			err("%s: timeout!!\n", __FUNCTION__);

  reply	other threads:[~2004-11-01 18:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-30 22:42 [patch 10/18] net/g96100eth: replace gt96100_delay() with msleep_interruptible() janitor
2004-10-31 11:06 ` Jeff Garzik
2004-11-01 18:17   ` Nishanth Aravamudan [this message]
2004-11-01 19:08     ` [PATCH] net/gt96100eth: " Nishanth Aravamudan
2004-11-05  7:47     ` [KJ] Re: [PATCH] net/gt96100eth: replace gt96100_delay() with Jeff Garzik
2004-11-05  7:47       ` [PATCH] net/gt96100eth: replace gt96100_delay() with msleep_interruptible() Jeff Garzik
2004-11-05 17:46       ` [KJ] Re: [PATCH] net/gt96100eth: replace gt96100_delay() with Nishanth Aravamudan
2004-11-05 17:46       ` [PATCH] net/gt96100eth: replace gt96100_delay() with 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=20041101190841.GB1730@us.ibm.com \
    --to=nacc@us.ibm.com \
    --cc=jgarzik@pobox.com \
    --cc=kernel-janitors@lists.osdl.org \
    --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 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.