Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b8bc674 authored by Russell King's avatar Russell King Committed by David S. Miller
Browse files

net: mvneta: ensure PM paths take the rtnl lock



The netdev core always ensures that the rtnl lock is held while calling
the ndo_open() and ndo_stop() methods. However, the suspend/resume paths
do not hold the rtnl lock. phylink will expect the rtnl lock to be held
when the MAC driver calls it, so we end up with kernel warnings. Take
the lock to ensure that these functions are called in a consistent
manner.

Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d033a236
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -4426,8 +4426,10 @@ static int mvneta_suspend(struct device *device)
	struct net_device *dev = dev_get_drvdata(device);
	struct mvneta_port *pp = netdev_priv(dev);

	rtnl_lock();
	if (netif_running(dev))
		mvneta_stop(dev);
	rtnl_unlock();
	netif_device_detach(dev);
	clk_disable_unprepare(pp->clk_bus);
	clk_disable_unprepare(pp->clk);
@@ -4464,10 +4466,12 @@ static int mvneta_resume(struct device *device)
		mvneta_fixed_link_update(pp, dev->phydev);

	netif_device_attach(dev);
	rtnl_lock();
	if (netif_running(dev)) {
		mvneta_open(dev);
		mvneta_set_rx_mode(dev);
	}
	rtnl_unlock();

	return 0;
}