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

Commit f62f896a authored by Nicolas Ferre's avatar Nicolas Ferre Committed by Greg Kroah-Hartman
Browse files

net: macb: fix call to pm_runtime in the suspend/resume functions



[ Upstream commit 6c8f85cac98a4c6b767c4c4f6af7283724c32b47 ]

The calls to pm_runtime_force_suspend/resume() functions are only
relevant if the device is not configured to act as a WoL wakeup source.
Add the device_may_wakeup() test before calling them.

Fixes: 3e2a5e15 ("net: macb: add wake-on-lan support via magic packet")
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: Harini Katakam <harini.katakam@xilinx.com>
Cc: Sergio Prado <sergio.prado@e-labworks.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ad396c48
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -4453,6 +4453,7 @@ static int __maybe_unused macb_suspend(struct device *dev)
	netif_carrier_off(netdev);
	if (bp->ptp_info)
		bp->ptp_info->ptp_remove(netdev);
	if (!device_may_wakeup(dev))
		pm_runtime_force_suspend(dev);

	return 0;
@@ -4468,6 +4469,7 @@ static int __maybe_unused macb_resume(struct device *dev)
	if (!netif_running(netdev))
		return 0;

	if (!device_may_wakeup(dev))
		pm_runtime_force_resume(dev);

	if (bp->wol & MACB_WOL_ENABLED) {