[PATCH v7 04/15] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing

Damon Ding posted 15 patches 11 months, 2 weeks ago
There is a newer version of this series
[PATCH v7 04/15] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing
Posted by Damon Ding 11 months, 2 weeks ago
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")
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
---
 .../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 e23af674d91c..d9dafb038e7a 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1608,10 +1608,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
 	dp->reg_base = devm_ioremap_resource(&pdev->dev, res);
-	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");
 
@@ -1623,8 +1621,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) {
@@ -1644,8 +1641,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,
@@ -1654,14 +1650,10 @@ 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);
 	}
 
 	return dp;
-
-err_disable_clk:
-	clk_disable_unprepare(dp->clock);
-	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(analogix_dp_probe);
 
-- 
2.34.1
Re: [PATCH v7 04/15] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing
Posted by Doug Anderson 11 months, 2 weeks ago
Hi,

On Mon, Feb 24, 2025 at 12:14 AM Damon Ding <damon.ding@rock-chips.com> 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.
>
> Fixes: f37952339cc2 ("drm/bridge: analogix_dp: handle clock via runtime PM")

When possible "Fixes" should be pushed to the start of your series so
it's obvious they have no dependencies when being picked to stable
kernels. That should be possible here.

> Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
> ---
>  .../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 e23af674d91c..d9dafb038e7a 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1608,10 +1608,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
>         dp->reg_base = devm_ioremap_resource(&pdev->dev, res);

There is a context conflict when I apply to drm-misc-next because of
commit 43c00fb1a518 ("drm/bridge: analogix_dp: Use
devm_platform_ioremap_resource()"). You probably should rebase and
re-apply.

Aside from the context conflict, this looks great to me:

Suggested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Re: [PATCH v7 04/15] drm/bridge: analogix_dp: Remove the unnecessary calls to clk_disable_unprepare() during probing
Posted by Damon Ding 11 months, 2 weeks ago
Hi Doug,

On 2025/2/25 9:40, Doug Anderson wrote:
> Hi,
> 
> On Mon, Feb 24, 2025 at 12:14 AM Damon Ding <damon.ding@rock-chips.com> 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.
>>
>> Fixes: f37952339cc2 ("drm/bridge: analogix_dp: handle clock via runtime PM")
> 
> When possible "Fixes" should be pushed to the start of your series so
> it's obvious they have no dependencies when being picked to stable
> kernels. That should be possible here.
> 
>> Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
>> ---
>>   .../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 e23af674d91c..d9dafb038e7a 100644
>> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
>> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
>> @@ -1608,10 +1608,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
>>          res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>
>>          dp->reg_base = devm_ioremap_resource(&pdev->dev, res);
> 
> There is a context conflict when I apply to drm-misc-next because of
> commit 43c00fb1a518 ("drm/bridge: analogix_dp: Use
> devm_platform_ioremap_resource()"). You probably should rebase and
> re-apply.
> 
> Aside from the context conflict, this looks great to me:
> 
> Suggested-by: Douglas Anderson <dianders@chromium.org>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> 
> 

After rebasing, I found the conflict. I will move this patch to a 
separate series and ensure it has no dependencies.

Best regards
Damon