linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
@ 2022-01-05 12:04 Miaoqian Lin
  2022-01-06 11:57 ` Dave Stevenson
  0 siblings, 1 reply; 6+ messages in thread
From: Miaoqian Lin @ 2022-01-05 12:04 UTC (permalink / raw)
  Cc: linmq006, Emma Anholt, David Airlie, Daniel Vetter, Eric Anholt,
	dri-devel, linux-kernel

The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().

Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index bd46396a1ae0..4f293aa733b8 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -300,6 +300,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 	v3d_gem_destroy(drm);
 dma_free:
 	dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
+pm_disable:
+	pm_runtime_disable(dev);
 	return ret;
 }
 
-- 
2.17.1


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

* Re: [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
  2022-01-05 12:04 [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe Miaoqian Lin
@ 2022-01-06 11:57 ` Dave Stevenson
  2022-01-06 12:46   ` [PATCH v2] " Miaoqian Lin
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Stevenson @ 2022-01-06 11:57 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Emma Anholt, David Airlie, LKML, DRI Development, Eric Anholt

Thanks for the patch.

On Wed, 5 Jan 2022 at 12:04, Miaoqian Lin <linmq006@gmail.com> wrote:
>
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
>
> Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index bd46396a1ae0..4f293aa733b8 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -300,6 +300,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>         v3d_gem_destroy(drm);
>  dma_free:
>         dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> +pm_disable:
> +       pm_runtime_disable(dev);

The dma_alloc_wc is done before the pm_runtime_enable, so the cleanup
should be in the opposite order.
Functionally it makes minimal difference in this case as
pm_runtime_enable can't fail, but could cause confusion/errors should
any other initialisation step be added between the two.

The pm_disable label is also unused so not necessary, however if
reversing the order then renaming dma_free to pm_disable would be
sensible.

  Dave

>         return ret;
>  }

>
> --
> 2.17.1
>

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

* [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
  2022-01-06 11:57 ` Dave Stevenson
@ 2022-01-06 12:46   ` Miaoqian Lin
  2022-01-07 11:03     ` Dave Stevenson
  2022-01-09 17:48     ` Melissa Wen
  0 siblings, 2 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-01-06 12:46 UTC (permalink / raw)
  To: dave.stevenson; +Cc: airlied, dri-devel, emma, eric, linmq006, linux-kernel

The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().

Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
Changes in v2
- put pm_runtime_disable before dma_free_wc
- rename dma_free to pm_disable
---
 drivers/gpu/drm/v3d/v3d_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index bd46396a1ae0..7d500dd5314e 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -282,7 +282,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 
 	ret = v3d_gem_init(drm);
 	if (ret)
-		goto dma_free;
+		goto pm_disable;
 
 	ret = v3d_irq_init(v3d);
 	if (ret)
@@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 	v3d_irq_disable(v3d);
 gem_destroy:
 	v3d_gem_destroy(drm);
-dma_free:
+pm_disable:
+	pm_runtime_disable(dev);
 	dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
 	return ret;
 }
-- 
2.17.1


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

* Re: [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
  2022-01-06 12:46   ` [PATCH v2] " Miaoqian Lin
@ 2022-01-07 11:03     ` Dave Stevenson
  2022-01-09 17:48     ` Melissa Wen
  1 sibling, 0 replies; 6+ messages in thread
From: Dave Stevenson @ 2022-01-07 11:03 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: David Airlie, DRI Development, Eric Anholt, Eric Anholt, LKML

On Thu, 6 Jan 2022 at 12:47, Miaoqian Lin <linmq006@gmail.com> wrote:
>
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
>
> Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Thanks for the update - that looks good to me.

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

> ---
> Changes in v2
> - put pm_runtime_disable before dma_free_wc
> - rename dma_free to pm_disable
> ---
>  drivers/gpu/drm/v3d/v3d_drv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index bd46396a1ae0..7d500dd5314e 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -282,7 +282,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>
>         ret = v3d_gem_init(drm);
>         if (ret)
> -               goto dma_free;
> +               goto pm_disable;
>
>         ret = v3d_irq_init(v3d);
>         if (ret)
> @@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>         v3d_irq_disable(v3d);
>  gem_destroy:
>         v3d_gem_destroy(drm);
> -dma_free:
> +pm_disable:
> +       pm_runtime_disable(dev);
>         dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
>         return ret;
>  }
> --
> 2.17.1
>

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

* Re: [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
  2022-01-06 12:46   ` [PATCH v2] " Miaoqian Lin
  2022-01-07 11:03     ` Dave Stevenson
@ 2022-01-09 17:48     ` Melissa Wen
  2022-01-10  3:05       ` Miaoqian Lin
  1 sibling, 1 reply; 6+ messages in thread
From: Melissa Wen @ 2022-01-09 17:48 UTC (permalink / raw)
  To: Miaoqian Lin; +Cc: dave.stevenson, emma, airlied, linux-kernel, dri-devel, eric

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

On 01/06, Miaoqian Lin wrote:
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
> 
> Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> Changes in v2
> - put pm_runtime_disable before dma_free_wc
> - rename dma_free to pm_disable
> ---
>  drivers/gpu/drm/v3d/v3d_drv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index bd46396a1ae0..7d500dd5314e 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -282,7 +282,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>  
>  	ret = v3d_gem_init(drm);
>  	if (ret)
> -		goto dma_free;
> +		goto pm_disable;
>  
>  	ret = v3d_irq_init(v3d);
>  	if (ret)
> @@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>  	v3d_irq_disable(v3d);
>  gem_destroy:
>  	v3d_gem_destroy(drm);
> -dma_free:
> +pm_disable:
> +	pm_runtime_disable(dev);

Hi,

I see this pm_runtime_disable balancing is also missing for
v3d_platform_drm_remove(), right?

BR,

Melissa
>  	dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
>  	return ret;
>  }
> -- 
> 2.17.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
  2022-01-09 17:48     ` Melissa Wen
@ 2022-01-10  3:05       ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-01-10  3:05 UTC (permalink / raw)
  To: Melissa Wen; +Cc: dave.stevenson, emma, airlied, linux-kernel, dri-devel, eric

Hi Melissa,

On Sun, Jan 09, 2022 at 04:48:17PM -0100, Melissa Wen wrote:
> On 01/06, Miaoqian Lin wrote:
> > The pm_runtime_enable will increase power disable depth.
> > If the probe fails, we should use pm_runtime_disable() to balance
> > pm_runtime_enable().
> > 
> >  	if (ret)
> > -		goto dma_free;
> > +		goto pm_disable;
> >  
> >  	ret = v3d_irq_init(v3d);
> >  	if (ret)
> > @@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> >  	v3d_irq_disable(v3d);
> >  gem_destroy:
> >  	v3d_gem_destroy(drm);
> > -dma_free:
> > +pm_disable:
> > +	pm_runtime_disable(dev);
> 
> Hi,
> 
> I see this pm_runtime_disable balancing is also missing for
> v3d_platform_drm_remove(), right?
> 
I think, yes. 

> >  	dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> >  	return ret;
> >  }
> > -- 
> > 2.17.1
> > 



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

end of thread, other threads:[~2022-01-10  3:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 12:04 [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe Miaoqian Lin
2022-01-06 11:57 ` Dave Stevenson
2022-01-06 12:46   ` [PATCH v2] " Miaoqian Lin
2022-01-07 11:03     ` Dave Stevenson
2022-01-09 17:48     ` Melissa Wen
2022-01-10  3:05       ` Miaoqian Lin

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).