All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: dhananjay@netxen.com, netdev@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] netxen: only half timeout waited
Date: Tue, 17 Feb 2009 07:33:12 +0000	[thread overview]
Message-ID: <20090217073312.GA4677@ff.dom.local> (raw)
In-Reply-To: <4999704A.9030004@gmail.com>

On 16-02-2009 14:55, Roel Kluin wrote:
> Only half the timeout was waited, due to the double increment, and an error
> occurred one too early.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
> index c3b9c83..df3aa08 100644
> --- a/drivers/net/netxen/netxen_nic_niu.c
> +++ b/drivers/net/netxen/netxen_nic_niu.c
> @@ -147,12 +147,11 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
>  					  NETXEN_NIU_GB_MII_MGMT_INDICATE(0),
>  					  &status, 4))
>  			return -EIO;
> -		timeout++;
>  	} while ((netxen_get_gb_mii_mgmt_busy(status)
>  		  || netxen_get_gb_mii_mgmt_notvalid(status))
>  		 && (timeout++ < NETXEN_NIU_PHY_WAITMAX));
>  
> -	if (timeout < NETXEN_NIU_PHY_WAITMAX) {
> +	if (timeout <= NETXEN_NIU_PHY_WAITMAX) {

Roel, very good caches, but IMHO in all such cases changing to
++timeout with 'if (timeout == NETXEN_NIU_PHY_WAITMAX)' where
possible, should be really more readable. At least wrt. next similar
patches.

Thanks,
Jarek P.

>  		if (adapter->hw_read_wx(adapter,
>  					  NETXEN_NIU_GB_MII_MGMT_STATUS(0),
>  					  readval, 4))
> @@ -240,11 +239,10 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg,
>  					  NETXEN_NIU_GB_MII_MGMT_INDICATE(0),
>  					  &status, 4))
>  			return -EIO;
> -		timeout++;
>  	} while ((netxen_get_gb_mii_mgmt_busy(status))
>  		 && (timeout++ < NETXEN_NIU_PHY_WAITMAX));
>  
> -	if (timeout < NETXEN_NIU_PHY_WAITMAX)
> +	if (timeout <= NETXEN_NIU_PHY_WAITMAX)
>  		result = 0;
>  	else
>  		result = -EIO;

  reply	other threads:[~2009-02-17  7:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16 13:55 [PATCH] netxen: only half timeout waited Roel Kluin
2009-02-17  7:33 ` Jarek Poplawski [this message]
2009-02-17  7:41   ` Jarek Poplawski

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=20090217073312.GA4677@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhananjay@netxen.com \
    --cc=netdev@vger.kernel.org \
    --cc=roel.kluin@gmail.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.