Skip to contentSkip to conversation

net: phy: make mdio_bus_phy_suspend/resume as __maybe_unused

PATCH Applied Arnd Bergmann 3 participants 3 messages Feb 25, 2021 – Feb 26, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: make mdio_bus_phy_suspend/resume as __maybe_unused

From: Arnd Bergmann <[email protected]>

When CONFIG_PM_SLEEP is disabled, the compiler warns about unused functions:

drivers/net/phy/phy_device.c:273:12: error: unused function 'mdio_bus_phy_suspend' [-Werror,-Wunused-function] static int mdio_bus_phy_suspend(struct device *dev)
drivers/net/phy/phy_device.c:293:12: error: unused function 'mdio_bus_phy_resume' [-Werror,-Wunused-function] static int mdio_bus_phy_resume(struct device *dev)

The logic is intentional, so just mark these two as __maybe_unused and remove the incorrect #ifdef.

Fixes 4c0d2e96ba05 ("net: phy: consider that suspend2ram may cut off PHY power")
---
 drivers/net/phy/phy_device.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/phy/phy_device.c +2 -4
index ce495473cd5d..cc38e326405a 100644
@@ -230,7 +230,6 @@ static struct phy_driver genphy_driver;
 static LIST_HEAD(phy_fixup_list);
 static DEFINE_MUTEX(phy_fixup_lock);
 
-#ifdef CONFIG_PM
 static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
 {
 	struct device_driver *drv = phydev->mdio.dev.driver;
@@ -270,7 +269,7 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
 	return !phydev->suspended;
 }
 
-static int mdio_bus_phy_suspend(struct device *dev)
+static __maybe_unused int mdio_bus_phy_suspend(struct device *dev)
 {
 	struct phy_device *phydev = to_phy_device(dev);
 
@@ -290,7 +289,7 @@ static int mdio_bus_phy_suspend(struct device *dev)
 	return phy_suspend(phydev);
 }
 
-static int mdio_bus_phy_resume(struct device *dev)
+static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
 {
 	struct phy_device *phydev = to_phy_device(dev);
 	int ret;
@@ -316,7 +315,6 @@ static int mdio_bus_phy_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend,
 			 mdio_bus_phy_resume);
-#endif /* CONFIG_PM */
 
 /**
  * phy_register_fixup - creates a new phy_fixup and adds it to the list
Signature · 1 line
2.29.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

When CONFIG_PM_SLEEP is disabled, the compiler warns about unused functions:

drivers/net/phy/phy_device.c:273:12: error: unused function 'mdio_bus_phy_suspend' [-Werror,-Wunused-function] static int mdio_bus_phy_suspend(struct device *dev)
drivers/net/phy/phy_device.c:293:12: error: unused function 'mdio_bus_phy_resume' [-Werror,-Wunused-function] static int mdio_bus_phy_resume(struct device *dev)

Quoted 5 lines

The logic is intentional, so just mark these two as __maybe_unused and remove the incorrect #ifdef.

Fixes 4c0d2e96ba05 ("net: phy: consider that suspend2ram may cut off PHY power")

Andrew

maintainer Applied
#2 lore raw
Quoted 11 lines · On Thu, 25 Feb 2021 23:53:20 +0100 Andrew Lunn wrote:
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

When CONFIG_PM_SLEEP is disabled, the compiler warns about unused functions:

drivers/net/phy/phy_device.c:273:12: error: unused function 'mdio_bus_phy_suspend' [-Werror,-Wunused-function] static int mdio_bus_phy_suspend(struct device *dev)
drivers/net/phy/phy_device.c:293:12: error: unused function 'mdio_bus_phy_resume' [-Werror,-Wunused-function] static int mdio_bus_phy_resume(struct device *dev)

Quoted 7 lines
Quoted 5 lines

The logic is intentional, so just mark these two as __maybe_unused and remove the incorrect #ifdef.

Fixes 4c0d2e96ba05 ("net: phy: consider that suspend2ram may cut off PHY power")

Applied, thanks!