netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@sunsite.dk>
To: Roel Kluin <12o3l@tiscali.nl>, jeff@garzik.org, dustin@sensoria.com
Cc: nico@cam.org, netdev@vger.kernel.org,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] smc911x: test after postfix decrement fails in smc911x_{reset,drop_pkt}
Date: Thu, 10 Apr 2008 11:00:03 +0200	[thread overview]
Message-ID: <87abk2axv0.fsf@macbook.be.48ers.dk> (raw)
In-Reply-To: <47FC922A.6030309@tiscali.nl> (Roel Kluin's message of "Wed\, 09 Apr 2008 11\:53\:46 +0200")

>>>>> "Roel" == Roel Kluin <12o3l@tiscali.nl> writes:

 Roel> When timeout reaches 0 the postfix decrement still subtracts,
 Roel> so the test fails

Ahh, good catch. Notice that Nicolas isn't the author of smc911x,
Dustin McIntire is.

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

 Roel> Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
 Roel> ---
 Roel> diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
 Roel> index 76cc1d3..2126d24 100644
 Roel> --- a/drivers/net/smc911x.c
 Roel> +++ b/drivers/net/smc911x.c
 Roel> @@ -243,7 +243,7 @@ static void smc911x_reset(struct net_device *dev)
 Roel>  		do {
 Roel>  			udelay(10);
 Roel>  			reg = SMC_GET_PMT_CTRL() & PMT_CTRL_READY_;
 Roel> -		} while ( timeout-- && !reg);
 Roel> +		} while ( --timeout && !reg);
 Roel>  		if (timeout == 0) {
 Roel>  			PRINTK("%s: smc911x_reset timeout waiting for PM restore\n", dev->name);
 Roel>  			return;
 Roel> @@ -267,7 +267,7 @@ static void smc911x_reset(struct net_device *dev)
 Roel>  				resets++;
 Roel>  				break;
 Roel>  			}
 Roel> -		} while ( timeout-- && (reg & HW_CFG_SRST_));
 Roel> +		} while ( --timeout && (reg & HW_CFG_SRST_));
 Roel>  	}
 Roel>  	if (timeout == 0) {
 Roel>  		PRINTK("%s: smc911x_reset timeout waiting for reset\n", dev->name);
 Roel> @@ -413,7 +413,7 @@ static inline void smc911x_drop_pkt(struct net_device *dev)
 Roel>  		do {
 Roel>  			udelay(10);
 Roel>  			reg = SMC_GET_RX_DP_CTRL() & RX_DP_CTRL_FFWD_BUSY_;
 Roel> -		} while ( timeout-- && reg);
 Roel> +		} while ( --timeout && reg);
 Roel>  		if (timeout == 0) {
 Roel>  			PRINTK("%s: timeout waiting for RX fast forward\n", dev->name);
 Roel>  		}
 Roel> --

-- 
Bye, Peter Korsgaard

      reply	other threads:[~2008-04-10  9:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09  9:53 [PATCH] smc911x: test after postfix decrement fails in smc911x_{reset,drop_pkt} Roel Kluin
2008-04-10  9:00 ` Peter Korsgaard [this message]

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=87abk2axv0.fsf@macbook.be.48ers.dk \
    --to=jacmet@sunsite.dk \
    --cc=12o3l@tiscali.nl \
    --cc=dustin@sensoria.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nico@cam.org \
    /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).