All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Clark Wang <xiaoning.wang@nxp.com>
Cc: peppe.cavallaro@st.com, alexandre.torgue@foss.st.com,
	joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-imx@nxp.com
Subject: Re: [PATCH] net: stmmac: linkup phy after enabled mac when system resume
Date: Wed, 19 Oct 2022 13:49:28 +0100	[thread overview]
Message-ID: <Y0/yWHvHs6NHdB8W@shell.armlinux.org.uk> (raw)
In-Reply-To: <20221019123643.1937889-1-xiaoning.wang@nxp.com>

On Wed, Oct 19, 2022 at 08:36:43PM +0800, Clark Wang wrote:
> +	mutex_unlock(&priv->lock);
> +	if (device_may_wakeup(priv->device) && priv->plat->pmt) {
> +		phylink_resume(priv->phylink);
> +	} else {
> +		phylink_resume(priv->phylink);
> +		if (device_may_wakeup(priv->device))
> +			phylink_speed_up(priv->phylink);
> +	}
> +	mutex_lock(&priv->lock);

First, is there a reason this isn't coded as:

	mutex_unlock(&priv->lock);
	phylink_resume(priv->phylink);

	if (!priv->plat->pmt && device_may_wakeup(priv->device))
		phylink_speed_up(priv->phylink);

	mutex_lock(&priv->lock);

And secondly, is it really safe to drop this lock? What specifically
is the lock protecting? I see this isn't documented in the driver...

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Clark Wang <xiaoning.wang@nxp.com>
Cc: peppe.cavallaro@st.com, alexandre.torgue@foss.st.com,
	joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-imx@nxp.com
Subject: Re: [PATCH] net: stmmac: linkup phy after enabled mac when system resume
Date: Wed, 19 Oct 2022 13:49:28 +0100	[thread overview]
Message-ID: <Y0/yWHvHs6NHdB8W@shell.armlinux.org.uk> (raw)
In-Reply-To: <20221019123643.1937889-1-xiaoning.wang@nxp.com>

On Wed, Oct 19, 2022 at 08:36:43PM +0800, Clark Wang wrote:
> +	mutex_unlock(&priv->lock);
> +	if (device_may_wakeup(priv->device) && priv->plat->pmt) {
> +		phylink_resume(priv->phylink);
> +	} else {
> +		phylink_resume(priv->phylink);
> +		if (device_may_wakeup(priv->device))
> +			phylink_speed_up(priv->phylink);
> +	}
> +	mutex_lock(&priv->lock);

First, is there a reason this isn't coded as:

	mutex_unlock(&priv->lock);
	phylink_resume(priv->phylink);

	if (!priv->plat->pmt && device_may_wakeup(priv->device))
		phylink_speed_up(priv->phylink);

	mutex_lock(&priv->lock);

And secondly, is it really safe to drop this lock? What specifically
is the lock protecting? I see this isn't documented in the driver...

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2022-10-19 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 12:36 [PATCH] net: stmmac: linkup phy after enabled mac when system resume Clark Wang
2022-10-19 12:36 ` Clark Wang
2022-10-19 12:49 ` Russell King (Oracle) [this message]
2022-10-19 12:49   ` Russell King (Oracle)

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=Y0/yWHvHs6NHdB8W@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=alexandre.torgue@foss.st.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=xiaoning.wang@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.