All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dejin Zheng <zhengdejin5@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: f.fainelli@gmail.com, hkallweit1@gmail.com,
	linux@armlinux.org.uk, davem@davemloft.net,
	gregkh@linuxfoundation.org, broonie@kernel.org,
	alexios.zavras@intel.com, tglx@linutronix.de,
	mchehab+samsung@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 6/9] net: phy: marvell10g: use phy_read_mmd_poll_timeout() to simplify the code
Date: Mon, 23 Mar 2020 00:18:14 +0800	[thread overview]
Message-ID: <20200322161814.GA20189@nuc8i5> (raw)
In-Reply-To: <20200322153659.GO11481@lunn.ch>

On Sun, Mar 22, 2020 at 04:36:59PM +0100, Andrew Lunn wrote:
> > --- a/drivers/net/phy/marvell10g.c
> > +++ b/drivers/net/phy/marvell10g.c
> > @@ -241,22 +241,17 @@ static int mv3310_power_up(struct phy_device *phydev)
> >  
> >  static int mv3310_reset(struct phy_device *phydev, u32 unit)
> >  {
> > -	int retries, val, err;
> > +	int val, err;
> >  
> >  	err = phy_modify_mmd(phydev, MDIO_MMD_PCS, unit + MDIO_CTRL1,
> >  			     MDIO_CTRL1_RESET, MDIO_CTRL1_RESET);
> >  	if (err < 0)
> >  		return err;
> >  
> > -	retries = 20;
> > -	do {
> > -		msleep(5);
> > -		val = phy_read_mmd(phydev, MDIO_MMD_PCS, unit + MDIO_CTRL1);
> > -		if (val < 0)
> > -			return val;
> > -	} while (val & MDIO_CTRL1_RESET && --retries);
> 
> This is another example of the sleep happening first. To keep the code
> more similar, you probably should add an msleep(5) before calling
> phy_read_mmd_poll_timeout().
> 
> 	Andrew
Andrew, you're right, do it right away. Thank you for helping me so
patiently!


  reply	other threads:[~2020-03-22 16:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22  6:55 [PATCH net-next v4 0/9] introduce read_poll_timeout Dejin Zheng
2020-03-22  6:55 ` [PATCH net-next v4 1/9] iopoll: introduce read_poll_timeout macro Dejin Zheng
2020-03-22  6:55 ` [PATCH net-next v4 2/9] iopoll: redefined readx_poll_timeout macro to simplify the code Dejin Zheng
2020-03-22  6:55 ` [PATCH net-next v4 3/9] net: phy: introduce phy_read_mmd_poll_timeout macro Dejin Zheng
2020-03-22 15:32   ` Andrew Lunn
2020-03-22  6:55 ` [PATCH net-next v4 4/9] net: phy: bcm84881: use phy_read_mmd_poll_timeout() to simplify the code Dejin Zheng
2020-03-22 15:33   ` Andrew Lunn
2020-03-22  6:55 ` [PATCH net-next v4 5/9] net: phy: aquantia: " Dejin Zheng
2020-03-22 15:34   ` Andrew Lunn
2020-03-22  6:55 ` [PATCH net-next v4 6/9] net: phy: marvell10g: " Dejin Zheng
2020-03-22 15:36   ` Andrew Lunn
2020-03-22 16:18     ` Dejin Zheng [this message]
2020-03-22  6:55 ` [PATCH net-next v4 7/9] net: phy: introduce phy_read_poll_timeout macro Dejin Zheng
2020-03-22 15:38   ` Andrew Lunn
2020-03-22  6:55 ` [PATCH net-next v4 8/9] net: phy: smsc: use phy_read_poll_timeout() to simplify the code Dejin Zheng
2020-03-22 15:39   ` Andrew Lunn
2020-03-22  6:55 ` [PATCH net-next v4 9/9] net: phy: tja11xx: " Dejin Zheng
2020-03-22 15:40   ` Andrew Lunn

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=20200322161814.GA20189@nuc8i5 \
    --to=zhengdejin5@gmail.com \
    --cc=alexios.zavras@intel.com \
    --cc=andrew@lunn.ch \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mchehab+samsung@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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.