All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Joakim Zhang <qiangqing.zhang@nxp.com>
Cc: peppe.cavallaro@st.com, alexandre.torgue@st.com,
	joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org,
	f.fainelli@gmail.com, linux-imx@nxp.com, netdev@vger.kernel.org
Subject: Re: [RFC V2 resend net-next 1/3] net: stmmac: add clocks management for gmac driver
Date: Wed, 3 Mar 2021 02:23:43 +0100	[thread overview]
Message-ID: <YD7lHzFxPPYA3M04@lunn.ch> (raw)
In-Reply-To: <20210301102529.18573-2-qiangqing.zhang@nxp.com>

On Mon, Mar 01, 2021 at 06:25:27PM +0800, Joakim Zhang wrote:
> @@ -121,11 +132,22 @@ static int stmmac_xgmac2_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
>  
>  	/* Wait until any existing MII operation is complete */
>  	if (readl_poll_timeout(priv->ioaddr + mii_data, tmp,
> -			       !(tmp & MII_XGMAC_BUSY), 100, 10000))
> -		return -EBUSY;
> +			       !(tmp & MII_XGMAC_BUSY), 100, 10000)) {
> +		ret = -EBUSY;
> +		goto err_disable_clks;
> +	}
>  
>  	/* Read the data from the MII data register */
> -	return readl(priv->ioaddr + mii_data) & GENMASK(15, 0);
> +	data = (int)readl(priv->ioaddr + mii_data) & GENMASK(15, 0);
> +
> +	pm_runtime_put(priv->device);
> +
> +	return data;
> +
> +err_disable_clks:
> +	pm_runtime_put(priv->device);
> +
> +	return ret;

Hi Joakim

You could do

	ret = (int)readl(priv->ioaddr + mii_data) & GENMASK(15, 0);

err_disable_clks:
	pm_runtime_put(priv->device);

	return ret;

Slightly simpler.

>  
>  	/* Read the data from the MII data register */
>  	data = (int)readl(priv->ioaddr + mii_data) & MII_DATA_MASK;
>  
> +	pm_runtime_put(priv->device);
> +
>  	return data;
> +
> +err_disable_clks:
> +	pm_runtime_put(priv->device);
> +
> +	return ret;
>  }

Same here.

Otherwise:

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

  reply	other threads:[~2021-03-03  4:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 10:25 [RFC V2 resend net-next 0/3] net: stmmac: implement clocks management Joakim Zhang
2021-03-01 10:25 ` [RFC V2 resend net-next 1/3] net: stmmac: add clocks management for gmac driver Joakim Zhang
2021-03-03  1:23   ` Andrew Lunn [this message]
2021-03-03  4:13     ` Joakim Zhang
2021-03-04  7:30   ` kernel test robot
2021-03-01 10:25 ` [RFC V2 resend net-next 2/3] net: stmmac: add platform level clocks management Joakim Zhang
2021-03-03  1:25   ` Andrew Lunn
2021-03-01 10:25 ` [RFC V2 resend net-next 3/3] net: stmmac: dwmac-imx: add platform level clocks management for i.MX Joakim Zhang
2021-03-03  1:27   ` 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=YD7lHzFxPPYA3M04@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=qiangqing.zhang@nxp.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.