All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Dejin Zheng <zhengdejin5@gmail.com>
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: Sun, 22 Mar 2020 16:36:59 +0100	[thread overview]
Message-ID: <20200322153659.GO11481@lunn.ch> (raw)
In-Reply-To: <20200322065555.17742-7-zhengdejin5@gmail.com>

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

  reply	other threads:[~2020-03-22 15:37 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 [this message]
2020-03-22 16:18     ` Dejin Zheng
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=20200322153659.GO11481@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alexios.zavras@intel.com \
    --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 \
    --cc=zhengdejin5@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.