Skip to content

Commit 4df614c

Browse files
committed
phy: core: Invoke pm_runtime_get_*/pm_runtime_put_* before invoking reset callback
PHY drivers may try to access PHY registers in the ->reset() callback. Invoke phy_pm_runtime_get_sync() before invoking the ->reset() callback so that the PHY drivers don't have to enable clocks by themselves before accessing PHY registers. Signed-off-by: Kishon Vijay Abraham I <[email protected]>
1 parent fec06b2 commit 4df614c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/phy/phy-core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,16 @@ int phy_reset(struct phy *phy)
384384
if (!phy || !phy->ops->reset)
385385
return 0;
386386

387+
ret = phy_pm_runtime_get_sync(phy);
388+
if (ret < 0 && ret != -ENOTSUPP)
389+
return ret;
390+
387391
mutex_lock(&phy->mutex);
388392
ret = phy->ops->reset(phy);
389393
mutex_unlock(&phy->mutex);
390394

395+
phy_pm_runtime_put(phy);
396+
391397
return ret;
392398
}
393399
EXPORT_SYMBOL_GPL(phy_reset);

0 commit comments

Comments
 (0)