aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phy/phy-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/phy/phy-core.c')
-rw-r--r--drivers/phy/phy-core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index cb38f6e8614c..c147ba843f0b 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -384,10 +384,16 @@ int phy_reset(struct phy *phy)
384 if (!phy || !phy->ops->reset) 384 if (!phy || !phy->ops->reset)
385 return 0; 385 return 0;
386 386
387 ret = phy_pm_runtime_get_sync(phy);
388 if (ret < 0 && ret != -ENOTSUPP)
389 return ret;
390
387 mutex_lock(&phy->mutex); 391 mutex_lock(&phy->mutex);
388 ret = phy->ops->reset(phy); 392 ret = phy->ops->reset(phy);
389 mutex_unlock(&phy->mutex); 393 mutex_unlock(&phy->mutex);
390 394
395 phy_pm_runtime_put(phy);
396
391 return ret; 397 return ret;
392} 398}
393EXPORT_SYMBOL_GPL(phy_reset); 399EXPORT_SYMBOL_GPL(phy_reset);
@@ -564,6 +570,11 @@ void phy_put(struct phy *phy)
564 if (!phy || IS_ERR(phy)) 570 if (!phy || IS_ERR(phy))
565 return; 571 return;
566 572
573 mutex_lock(&phy->mutex);
574 if (phy->ops->release)
575 phy->ops->release(phy);
576 mutex_unlock(&phy->mutex);
577
567 module_put(phy->ops->owner); 578 module_put(phy->ops->owner);
568 put_device(&phy->dev); 579 put_device(&phy->dev);
569} 580}