summaryrefslogtreecommitdiffstats
path: root/drivers/phy
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2019-04-05 16:38:30 +0530
committerKishon Vijay Abraham I <kishon@ti.com>2019-04-17 14:13:17 +0530
commitfec06b2bc436d1cbc3482becd40f656d46cd22b7 (patch)
tree87405f207d3eb80846221bc1297999714e953170 /drivers/phy
parent42c7cb71b5c2b014caab7861f2434f3907900d7c (diff)
downloadlinux-stable-fec06b2bc436d1cbc3482becd40f656d46cd22b7.tar.gz
linux-stable-fec06b2bc436d1cbc3482becd40f656d46cd22b7.tar.bz2
linux-stable-fec06b2bc436d1cbc3482becd40f656d46cd22b7.zip
phy: core: Add *release* phy_ops invoked when the consumer relinquishes PHY
Add a new phy_ops *release* invoked when the consumer relinquishes the PHY using phy_put/devm_phy_put. The initializations done by the PHY driver in of_xlate call back can be can be cleaned up here. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/phy-core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index cb38f6e8614c..b9a4ebf35dd3 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -564,6 +564,11 @@ void phy_put(struct phy *phy)
if (!phy || IS_ERR(phy))
return;
+ mutex_lock(&phy->mutex);
+ if (phy->ops->release)
+ phy->ops->release(phy);
+ mutex_unlock(&phy->mutex);
+
module_put(phy->ops->owner);
put_device(&phy->dev);
}