Skip to content

Commit

Permalink
phy: core: Invoke pm_runtime_get_*/pm_runtime_put_* before invoking r…
Browse files Browse the repository at this point in the history
…eset 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 <kishon@ti.com>
  • Loading branch information
Kishon Vijay Abraham I committed Apr 17, 2019
1 parent fec06b2 commit 4df614c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/phy/phy-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,16 @@ int phy_reset(struct phy *phy)
if (!phy || !phy->ops->reset)
return 0;

ret = phy_pm_runtime_get_sync(phy);
if (ret < 0 && ret != -ENOTSUPP)
return ret;

mutex_lock(&phy->mutex);
ret = phy->ops->reset(phy);
mutex_unlock(&phy->mutex);

phy_pm_runtime_put(phy);

return ret;
}
EXPORT_SYMBOL_GPL(phy_reset);
Expand Down

0 comments on commit 4df614c

Please sign in to comment.