* [PATCH v2] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy
@ 2018-03-20 6:01 Manu Gautam
2018-04-16 0:02 ` Manu Gautam
2018-04-23 6:42 ` Kishon Vijay Abraham I
0 siblings, 2 replies; 3+ messages in thread
From: Manu Gautam @ 2018-03-20 6:01 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: linux-arm-msm, Manu Gautam, open list:GENERIC PHY FRAMEWORK
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>
---
Changes for v2:
- Fixed compilation warning
drivers/phy/phy-core.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 3c31ce5..1fda576 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 @@ int phy_pm_runtime_get_sync(struct phy *phy)
int phy_pm_runtime_put(struct phy *phy)
{
+ if (!phy)
+ return 0;
+
if (!pm_runtime_enabled(&phy->dev))
return -ENOTSUPP;
@@ -190,6 +199,9 @@ int phy_pm_runtime_put(struct phy *phy)
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 @@ int phy_pm_runtime_put_sync(struct phy *phy)
void phy_pm_runtime_allow(struct phy *phy)
{
+ if (!phy)
+ return;
+
if (!pm_runtime_enabled(&phy->dev))
return;
@@ -208,6 +223,9 @@ void phy_pm_runtime_allow(struct phy *phy)
void phy_pm_runtime_forbid(struct phy *phy)
{
+ if (!phy)
+ return;
+
if (!pm_runtime_enabled(&phy->dev))
return;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy
2018-03-20 6:01 [PATCH v2] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy Manu Gautam
@ 2018-04-16 0:02 ` Manu Gautam
2018-04-23 6:42 ` Kishon Vijay Abraham I
1 sibling, 0 replies; 3+ messages in thread
From: Manu Gautam @ 2018-04-16 0:02 UTC (permalink / raw)
To: Kishon Vijay Abraham I; +Cc: linux-arm-msm, open list:GENERIC PHY FRAMEWORK
Hi Kishon,
On 3/20/2018 11:31 AM, Manu Gautam wrote:
> 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.
Wondering if you had a chance to review this.
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy
2018-03-20 6:01 [PATCH v2] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy Manu Gautam
2018-04-16 0:02 ` Manu Gautam
@ 2018-04-23 6:42 ` Kishon Vijay Abraham I
1 sibling, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2018-04-23 6:42 UTC (permalink / raw)
To: Manu Gautam; +Cc: linux-arm-msm, open list:GENERIC PHY FRAMEWORK
On Tuesday 20 March 2018 11:31 AM, Manu Gautam wrote:
> 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>
merged, thanks!
-Kishon
> ---
> Changes for v2:
> - Fixed compilation warning
>
> drivers/phy/phy-core.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 3c31ce5..1fda576 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 @@ int phy_pm_runtime_get_sync(struct phy *phy)
>
> int phy_pm_runtime_put(struct phy *phy)
> {
> + if (!phy)
> + return 0;
> +
> if (!pm_runtime_enabled(&phy->dev))
> return -ENOTSUPP;
>
> @@ -190,6 +199,9 @@ int phy_pm_runtime_put(struct phy *phy)
>
> 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 @@ int phy_pm_runtime_put_sync(struct phy *phy)
>
> void phy_pm_runtime_allow(struct phy *phy)
> {
> + if (!phy)
> + return;
> +
> if (!pm_runtime_enabled(&phy->dev))
> return;
>
> @@ -208,6 +223,9 @@ void phy_pm_runtime_allow(struct phy *phy)
>
> void phy_pm_runtime_forbid(struct phy *phy)
> {
> + if (!phy)
> + return;
> +
> if (!pm_runtime_enabled(&phy->dev))
> return;
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-23 6:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-20 6:01 [PATCH v2] phy: core: Allow phy_pm_runtime_xxx API calls with NULL phy Manu Gautam
2018-04-16 0:02 ` Manu Gautam
2018-04-23 6:42 ` Kishon Vijay Abraham I
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).