From fec06b2bc436d1cbc3482becd40f656d46cd22b7 Mon Sep 17 00:00:00 2001 From: Kishon Vijay Abraham I Date: Fri, 5 Apr 2019 16:38:30 +0530 Subject: 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 --- drivers/phy/phy-core.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/phy') 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); } -- cgit v1.2.3-59-g8ed1b