diff options
author | Manu Gautam <mgautam@codeaurora.org> | 2018-03-20 09:01:47 +0300 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2018-04-25 08:22:59 +0300 |
commit | 8866df25e56cd5ac067e70825e6f38f9f2363db9 (patch) | |
tree | 3d5d93497a111508df9698a1f5b9dd9507cc8911 /drivers/phy | |
parent | af09a5e926d67911ba2def00037ab8f7e19251a4 (diff) | |
download | linux-8866df25e56cd5ac067e70825e6f38f9f2363db9.tar.xz |
phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy
phy_init() and phy_exit() calls, and phy_power_on() and
phy_power_off() already accept NULL as valid PHY reference
and act as NOP. Extend same concept to phy runtime_pm APIs
to keep drivers (e.g. dwc3) code simple while dealing with
optional PHYs.
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/phy-core.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 09ac8afb97ac..35fd38c5a4a1 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -153,6 +153,9 @@ int phy_pm_runtime_get(struct phy *phy) { int ret; + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -168,6 +171,9 @@ int phy_pm_runtime_get_sync(struct phy *phy) { int ret; + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -181,6 +187,9 @@ EXPORT_SYMBOL_GPL(phy_pm_runtime_get_sync); int phy_pm_runtime_put(struct phy *phy) { + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -190,6 +199,9 @@ EXPORT_SYMBOL_GPL(phy_pm_runtime_put); int phy_pm_runtime_put_sync(struct phy *phy) { + if (!phy) + return 0; + if (!pm_runtime_enabled(&phy->dev)) return -ENOTSUPP; @@ -199,6 +211,9 @@ EXPORT_SYMBOL_GPL(phy_pm_runtime_put_sync); void phy_pm_runtime_allow(struct phy *phy) { + if (!phy) + return; + if (!pm_runtime_enabled(&phy->dev)) return; @@ -208,6 +223,9 @@ EXPORT_SYMBOL_GPL(phy_pm_runtime_allow); void phy_pm_runtime_forbid(struct phy *phy) { + if (!phy) + return; + if (!pm_runtime_enabled(&phy->dev)) return; |