diff mbox series

[01/16] phy: qcom-qmp-combo: disable runtime PM on unbind

Message ID 20220907110728.19092-2-johan+linaro@kernel.org (mailing list archive)
State Not Applicable
Headers show
Series phy: qcom-qmp: further clean ups | expand

Commit Message

Johan Hovold Sept. 7, 2022, 11:07 a.m. UTC
Make sure to disable runtime PM also on driver unbind.

Fixes: ac0d239936bd ("phy: qcom-qmp: Add support for runtime PM").
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Dmitry Baryshkov Sept. 9, 2022, 9:26 a.m. UTC | #1
On 07/09/2022 14:07, Johan Hovold wrote:
> Make sure to disable runtime PM also on driver unbind.

Nit: technically the subject is misleading: you switched the code to use 
devres- helpers rather than manually disabling the runtime PM.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> 
> Fixes: ac0d239936bd ("phy: qcom-qmp: Add support for runtime PM").
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
>   drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index af608c4dc869..9ce2ab56be4c 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -2930,7 +2930,9 @@ static int qcom_qmp_phy_combo_probe(struct platform_device *pdev)
>   		return -ENOMEM;
>   
>   	pm_runtime_set_active(dev);
> -	pm_runtime_enable(dev);
> +	ret = devm_pm_runtime_enable(dev);
> +	if (ret)
> +		return ret;
>   	/*
>   	 * Prevent runtime pm from being ON by default. Users can enable
>   	 * it using power/control in sysfs.
> @@ -2987,13 +2989,10 @@ static int qcom_qmp_phy_combo_probe(struct platform_device *pdev)
>   	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
>   	if (!IS_ERR(phy_provider))
>   		dev_info(dev, "Registered Qcom-QMP phy\n");
> -	else
> -		pm_runtime_disable(dev);
>   
>   	return PTR_ERR_OR_ZERO(phy_provider);
>   
>   err_node_put:
> -	pm_runtime_disable(dev);
>   	of_node_put(child);
>   	return ret;
>   }
Johan Hovold Sept. 9, 2022, 1:22 p.m. UTC | #2
On Fri, Sep 09, 2022 at 12:26:30PM +0300, Dmitry Baryshkov wrote:
> On 07/09/2022 14:07, Johan Hovold wrote:
> > Make sure to disable runtime PM also on driver unbind.
> 
> Nit: technically the subject is misleading: you switched the code to use 
> devres- helpers rather than manually disabling the runtime PM.

I disagree. I'm summarising what the patch is doing, not how I
implemented it.

> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Johan
diff mbox series

Patch

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index af608c4dc869..9ce2ab56be4c 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -2930,7 +2930,9 @@  static int qcom_qmp_phy_combo_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	pm_runtime_set_active(dev);
-	pm_runtime_enable(dev);
+	ret = devm_pm_runtime_enable(dev);
+	if (ret)
+		return ret;
 	/*
 	 * Prevent runtime pm from being ON by default. Users can enable
 	 * it using power/control in sysfs.
@@ -2987,13 +2989,10 @@  static int qcom_qmp_phy_combo_probe(struct platform_device *pdev)
 	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
 	if (!IS_ERR(phy_provider))
 		dev_info(dev, "Registered Qcom-QMP phy\n");
-	else
-		pm_runtime_disable(dev);
 
 	return PTR_ERR_OR_ZERO(phy_provider);
 
 err_node_put:
-	pm_runtime_disable(dev);
 	of_node_put(child);
 	return ret;
 }