[PATCH] net: stmmac: linkup phy after enabled mac when system resume

Russell King (Oracle) linux at armlinux.org.uk
Wed Oct 19 05:49:28 PDT 2022


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!



More information about the linux-arm-kernel mailing list