]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
phy: core: Discard pm_runtime_put() return values
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 22 Dec 2025 20:22:48 +0000 (21:22 +0100)
committerVinod Koul <vkoul@kernel.org>
Tue, 23 Dec 2025 17:41:03 +0000 (23:11 +0530)
The PHY core defines phy_pm_runtime_put() to return an int, but that
return value is never used.  It also passes the return value of
pm_runtime_put() to the caller which is not very useful.

Returning an error code from pm_runtime_put() merely means that it has
not queued up a work item to check whether or not the device can be
suspended and there are many perfectly valid situations in which that
can happen, like after writing "on" to the devices' runtime PM "control"
attribute in sysfs for one example.

Modify phy_pm_runtime_put() to discard the pm_runtime_put() return
value and change its return type to void.  Also drop the redundant
pm_runtime_enabled() call from there.

No intentional functional impact.

This will facilitate a planned change of the pm_runtime_put() return
type to void in the future.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/2556645.jE0xQCEvom@rafael.j.wysocki
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/phy-core.c
include/linux/phy/phy.h

index 8d227890a345fd1e3e08e32300df5de8b745aaec..160ecb757d1d62a0c03ad73079fd12c812559088 100644 (file)
@@ -190,15 +190,12 @@ int phy_pm_runtime_get_sync(struct phy *phy)
 }
 EXPORT_SYMBOL_GPL(phy_pm_runtime_get_sync);
 
-int phy_pm_runtime_put(struct phy *phy)
+void phy_pm_runtime_put(struct phy *phy)
 {
        if (!phy)
-               return 0;
-
-       if (!pm_runtime_enabled(&phy->dev))
-               return -ENOTSUPP;
+               return;
 
-       return pm_runtime_put(&phy->dev);
+       pm_runtime_put(&phy->dev);
 }
 EXPORT_SYMBOL_GPL(phy_pm_runtime_put);
 
index 2af0d01ebb39f27dfb34ccb5140771beef8288d5..ea47975e288aeadb2fa75af6db2984c9bc704472 100644 (file)
@@ -243,7 +243,7 @@ static inline void *phy_get_drvdata(struct phy *phy)
 #if IS_ENABLED(CONFIG_GENERIC_PHY)
 int phy_pm_runtime_get(struct phy *phy);
 int phy_pm_runtime_get_sync(struct phy *phy);
-int phy_pm_runtime_put(struct phy *phy);
+void phy_pm_runtime_put(struct phy *phy);
 int phy_pm_runtime_put_sync(struct phy *phy);
 int phy_init(struct phy *phy);
 int phy_exit(struct phy *phy);
@@ -324,11 +324,8 @@ static inline int phy_pm_runtime_get_sync(struct phy *phy)
        return -ENOSYS;
 }
 
-static inline int phy_pm_runtime_put(struct phy *phy)
+static inline void phy_pm_runtime_put(struct phy *phy)
 {
-       if (!phy)
-               return 0;
-       return -ENOSYS;
 }
 
 static inline int phy_pm_runtime_put_sync(struct phy *phy)