History

phy: core: Discard pm_runtime_put() return values

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.

Rafael J. Wysocki committed 10 months ago

Commit caad07a1 parent 455bf7d2 files · +5 −11Browse files

Unified · Split

2 files
  1. drivers/phy/phy-core.c +3 −6
  2. include/linux/phy/phy.h +2 −5
drivers/phy/phy-core.c+3−6
@@ -190,15 +190,12 @@ int phy_pm_runtime_get_sync(struct phy *phy) · 189 unmodified lines
190190 }
191191 EXPORT_SYMBOL_GPL(phy_pm_runtime_get_sync);
192192
193−int phy_pm_runtime_put(struct phy *phy)
193+void phy_pm_runtime_put(struct phy *phy)
194194 {
195195 if (!phy)
196− return 0;
197−
198− if (!pm_runtime_enabled(&phy->dev))
199− return -ENOTSUPP;
196+ return;
200197
201− return pm_runtime_put(&phy->dev);
198+ pm_runtime_put(&phy->dev);
202199 }
203200 EXPORT_SYMBOL_GPL(phy_pm_runtime_put);
204201
include/linux/phy/phy.h+2−5
@@ -243,7 +243,7 @@ static inline void *phy_get_drvdata(struct phy *phy) · 242 unmodified lines
243243 #if IS_ENABLED(CONFIG_GENERIC_PHY)
244244 int phy_pm_runtime_get(struct phy *phy);
245245 int phy_pm_runtime_get_sync(struct phy *phy);
246−int phy_pm_runtime_put(struct phy *phy);
246+void phy_pm_runtime_put(struct phy *phy);
247247 int phy_pm_runtime_put_sync(struct phy *phy);
248248 int phy_init(struct phy *phy);
249249 int phy_exit(struct phy *phy);
@@ -324,11 +324,8 @@ static inline int phy_pm_runtime_get_sync(struct phy *phy) · 74 unmodified lines
324324 return -ENOSYS;
325325 }
326326
327−static inline int phy_pm_runtime_put(struct phy *phy)
327+static inline void phy_pm_runtime_put(struct phy *phy)
328328 {
329− if (!phy)
330− return 0;
331− return -ENOSYS;
332329 }
333330
334331 static inline int phy_pm_runtime_put_sync(struct phy *phy)