The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v8] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing
@ 2025-03-02  8:30 Damon Ding
  2025-05-27 20:03 ` Heiko Stübner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Damon Ding @ 2025-03-02  8:30 UTC (permalink / raw)
  To: dianders, andrzej.hajda, neil.armstrong, rfoss
  Cc: dmitry.baryshkov, andy.yan, Laurent.pinchart, jonas,
	jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona, l.stach, dri-devel, linux-kernel, Damon Ding

With the commit f37952339cc2 ("drm/bridge: analogix_dp: handle clock via
runtime PM"), the PM operations can help enable/disable the clock. The
err_disable_clk label and clk_disable_unprepare() operations are no
longer necessary because the analogix_dp_resume() will not be called
during probing.

Fixes: f37952339cc2 ("drm/bridge: analogix_dp: handle clock via runtime PM")
Suggested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>

---

Picked from:
https://patchwork.kernel.org/project/linux-rockchip/list/?series=936932

Changes in v8:
- Fix the conflict because of commit 43c00fb1a518 ("drm/bridge:
  analogix_dp: Use devm_platform_ioremap_resource()")
---
 .../gpu/drm/bridge/analogix/analogix_dp_core.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index f6e4bdc05ba0..817070613b03 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1605,10 +1605,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
 	}
 
 	dp->reg_base = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(dp->reg_base)) {
-		ret = PTR_ERR(dp->reg_base);
-		goto err_disable_clk;
-	}
+	if (IS_ERR(dp->reg_base))
+		return ERR_CAST(dp->reg_base);
 
 	dp->force_hpd = of_property_read_bool(dev->of_node, "force-hpd");
 
@@ -1620,8 +1618,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
 	if (IS_ERR(dp->hpd_gpiod)) {
 		dev_err(dev, "error getting HDP GPIO: %ld\n",
 			PTR_ERR(dp->hpd_gpiod));
-		ret = PTR_ERR(dp->hpd_gpiod);
-		goto err_disable_clk;
+		return ERR_CAST(dp->hpd_gpiod);
 	}
 
 	if (dp->hpd_gpiod) {
@@ -1641,8 +1638,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
 
 	if (dp->irq == -ENXIO) {
 		dev_err(&pdev->dev, "failed to get irq\n");
-		ret = -ENODEV;
-		goto err_disable_clk;
+		return ERR_PTR(-ENODEV);
 	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, dp->irq,
@@ -1651,15 +1647,11 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
 					irq_flags, "analogix-dp", dp);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to request irq\n");
-		goto err_disable_clk;
+		return ERR_PTR(ret);
 	}
 	disable_irq(dp->irq);
 
 	return dp;
-
-err_disable_clk:
-	clk_disable_unprepare(dp->clock);
-	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(analogix_dp_probe);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v8] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing
  2025-03-02  8:30 [PATCH v8] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing Damon Ding
@ 2025-05-27 20:03 ` Heiko Stübner
  2025-05-27 20:06 ` [RESEND] " Heiko Stübner
  2025-05-27 20:14 ` Dmitry Baryshkov
  2 siblings, 0 replies; 4+ messages in thread
From: Heiko Stübner @ 2025-05-27 20:03 UTC (permalink / raw)
  To: dianders, andrzej.hajda, neil.armstrong, rfoss, dri-devel
  Cc: dmitry.baryshkov, andy.yan, Laurent.pinchart, jonas,
	jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona, l.stach, dri-devel, linux-kernel, Damon Ding, Damon Ding

Am Sonntag, 2. März 2025, 09:30:43 Mitteleuropäische Sommerzeit schrieb Damon Ding:
> With the commit f37952339cc2 ("drm/bridge: analogix_dp: handle clock via
> runtime PM"), the PM operations can help enable/disable the clock. The
> err_disable_clk label and clk_disable_unprepare() operations are no
> longer necessary because the analogix_dp_resume() will not be called
> during probing.
> 
> Fixes: f37952339cc2 ("drm/bridge: analogix_dp: handle clock via runtime PM")
> Suggested-by: Douglas Anderson <dianders@chromium.org>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Damon Ding <damon.ding@rock-chips.com>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

This patch seems to have fallen through the cracks?

dp->clock never gets enabled in analogix_dp_probe(), so reaching that
error handling code would create a enable-disable mismatch for the
dp>clock.


> ---
> 
> Picked from:
> https://patchwork.kernel.org/project/linux-rockchip/list/?series=936932
> 
> Changes in v8:
> - Fix the conflict because of commit 43c00fb1a518 ("drm/bridge:
>   analogix_dp: Use devm_platform_ioremap_resource()")
> ---
>  .../gpu/drm/bridge/analogix/analogix_dp_core.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index f6e4bdc05ba0..817070613b03 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1605,10 +1605,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  	}
>  
>  	dp->reg_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(dp->reg_base)) {
> -		ret = PTR_ERR(dp->reg_base);
> -		goto err_disable_clk;
> -	}
> +	if (IS_ERR(dp->reg_base))
> +		return ERR_CAST(dp->reg_base);
>  
>  	dp->force_hpd = of_property_read_bool(dev->of_node, "force-hpd");
>  
> @@ -1620,8 +1618,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  	if (IS_ERR(dp->hpd_gpiod)) {
>  		dev_err(dev, "error getting HDP GPIO: %ld\n",
>  			PTR_ERR(dp->hpd_gpiod));
> -		ret = PTR_ERR(dp->hpd_gpiod);
> -		goto err_disable_clk;
> +		return ERR_CAST(dp->hpd_gpiod);
>  	}
>  
>  	if (dp->hpd_gpiod) {
> @@ -1641,8 +1638,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  
>  	if (dp->irq == -ENXIO) {
>  		dev_err(&pdev->dev, "failed to get irq\n");
> -		ret = -ENODEV;
> -		goto err_disable_clk;
> +		return ERR_PTR(-ENODEV);
>  	}
>  
>  	ret = devm_request_threaded_irq(&pdev->dev, dp->irq,
> @@ -1651,15 +1647,11 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  					irq_flags, "analogix-dp", dp);
>  	if (ret) {
>  		dev_err(&pdev->dev, "failed to request irq\n");
> -		goto err_disable_clk;
> +		return ERR_PTR(ret);
>  	}
>  	disable_irq(dp->irq);
>  
>  	return dp;
> -
> -err_disable_clk:
> -	clk_disable_unprepare(dp->clock);
> -	return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(analogix_dp_probe);
>  
> 





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RESEND] Re: [PATCH v8] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing
  2025-03-02  8:30 [PATCH v8] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing Damon Ding
  2025-05-27 20:03 ` Heiko Stübner
@ 2025-05-27 20:06 ` Heiko Stübner
  2025-05-27 20:14 ` Dmitry Baryshkov
  2 siblings, 0 replies; 4+ messages in thread
From: Heiko Stübner @ 2025-05-27 20:06 UTC (permalink / raw)
  To: dianders, andrzej.hajda, neil.armstrong, rfoss, dri-devel,
	andy.yan
  Cc: Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
	mripard, tzimmermann, airlied, simona, l.stach, dri-devel,
	linux-kernel, Damon Ding, Damon Ding, Dmitry Baryshkov

[resending to update to Dmitry's new address]

Am Sonntag, 2. März 2025, 09:30:43 Mitteleuropäische Sommerzeit schrieb Damon Ding:
> With the commit f37952339cc2 ("drm/bridge: analogix_dp: handle clock via
> runtime PM"), the PM operations can help enable/disable the clock. The
> err_disable_clk label and clk_disable_unprepare() operations are no
> longer necessary because the analogix_dp_resume() will not be called
> during probing.
> 
> Fixes: f37952339cc2 ("drm/bridge: analogix_dp: handle clock via runtime PM")
> Suggested-by: Douglas Anderson <dianders@chromium.org>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Damon Ding <damon.ding@rock-chips.com>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

This patch seems to have fallen through the cracks?

dp->clock never gets enabled in analogix_dp_probe(), so reaching that
error handling code would create a enable-disable mismatch for the
dp>clock.


> ---
> 
> Picked from:
> https://patchwork.kernel.org/project/linux-rockchip/list/?series=936932
> 
> Changes in v8:
> - Fix the conflict because of commit 43c00fb1a518 ("drm/bridge:
>   analogix_dp: Use devm_platform_ioremap_resource()")
> ---
>  .../gpu/drm/bridge/analogix/analogix_dp_core.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index f6e4bdc05ba0..817070613b03 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1605,10 +1605,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  	}
>  
>  	dp->reg_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(dp->reg_base)) {
> -		ret = PTR_ERR(dp->reg_base);
> -		goto err_disable_clk;
> -	}
> +	if (IS_ERR(dp->reg_base))
> +		return ERR_CAST(dp->reg_base);
>  
>  	dp->force_hpd = of_property_read_bool(dev->of_node, "force-hpd");
>  
> @@ -1620,8 +1618,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  	if (IS_ERR(dp->hpd_gpiod)) {
>  		dev_err(dev, "error getting HDP GPIO: %ld\n",
>  			PTR_ERR(dp->hpd_gpiod));
> -		ret = PTR_ERR(dp->hpd_gpiod);
> -		goto err_disable_clk;
> +		return ERR_CAST(dp->hpd_gpiod);
>  	}
>  
>  	if (dp->hpd_gpiod) {
> @@ -1641,8 +1638,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  
>  	if (dp->irq == -ENXIO) {
>  		dev_err(&pdev->dev, "failed to get irq\n");
> -		ret = -ENODEV;
> -		goto err_disable_clk;
> +		return ERR_PTR(-ENODEV);
>  	}
>  
>  	ret = devm_request_threaded_irq(&pdev->dev, dp->irq,
> @@ -1651,15 +1647,11 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>  					irq_flags, "analogix-dp", dp);
>  	if (ret) {
>  		dev_err(&pdev->dev, "failed to request irq\n");
> -		goto err_disable_clk;
> +		return ERR_PTR(ret);
>  	}
>  	disable_irq(dp->irq);
>  
>  	return dp;
> -
> -err_disable_clk:
> -	clk_disable_unprepare(dp->clock);
> -	return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(analogix_dp_probe);
>  
> 





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v8] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing
  2025-03-02  8:30 [PATCH v8] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing Damon Ding
  2025-05-27 20:03 ` Heiko Stübner
  2025-05-27 20:06 ` [RESEND] " Heiko Stübner
@ 2025-05-27 20:14 ` Dmitry Baryshkov
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2025-05-27 20:14 UTC (permalink / raw)
  To: dianders, andrzej.hajda, neil.armstrong, rfoss, Damon Ding
  Cc: andy.yan, Laurent.pinchart, jonas, jernej.skrabec,
	maarten.lankhorst, mripard, tzimmermann, airlied, simona, l.stach,
	dri-devel, linux-kernel, Dmitry Baryshkov

On Sun, 02 Mar 2025 16:30:43 +0800, Damon Ding wrote:
> With the commit f37952339cc2 ("drm/bridge: analogix_dp: handle clock via
> runtime PM"), the PM operations can help enable/disable the clock. The
> err_disable_clk label and clk_disable_unprepare() operations are no
> longer necessary because the analogix_dp_resume() will not be called
> during probing.
> 
> 
> [...]

Applied to drm-misc-next-fixes, thanks!

[1/1] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing
      commit: 6579a03e68ffa5feb2d2823dea16ca7466f6de16

Best regards,
-- 
With best wishes
Dmitry



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-27 20:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-02  8:30 [PATCH v8] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing Damon Ding
2025-05-27 20:03 ` Heiko Stübner
2025-05-27 20:06 ` [RESEND] " Heiko Stübner
2025-05-27 20:14 ` Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox