[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<TY3PR01MB113463D1C0F25F3F10A5A0F3B8603A@TY3PR01MB11346.jpnprd01.prod.outlook.com>
Date: Fri, 5 Sep 2025 16:17:15 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>, Tommaso Merciai
<tomm.merciai@...il.com>
CC: "linux-renesas-soc@...r.kernel.org" <linux-renesas-soc@...r.kernel.org>,
Vinod Koul <vkoul@...nel.org>, Geert Uytterhoeven <geert+renesas@...der.be>,
wsa+renesas <wsa+renesas@...g-engineering.com>, Fabrizio Castro
<fabrizio.castro.jz@...esas.com>, Uwe Kleine-König
<u.kleine-koenig@...libre.com>, "dmaengine@...r.kernel.org"
<dmaengine@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 3/4] dmaengine: sh: rz-dmac: Refactor runtime PM handling
Hi Tommaso,
> -----Original Message-----
> From: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>
> Sent: 05 September 2025 15:44
> Subject: [PATCH 3/4] dmaengine: sh: rz-dmac: Refactor runtime PM handling
>
> Refactor runtime PM handling to ensure correct power management and prevent resource leaks. Invoke
> pm_runtime_get_sync() when allocating DMA channel resources and pm_runtime_put() when freeing them.
> Add pm_runtime_put() in
> rz_dmac_probe() to balance the usage count during device initialization, and remove the unnecessary
> pm_runtime_put() from rz_dmac_remove() to avoid PM inconsistencies.
>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>
> ---
> drivers/dma/sh/rz-dmac.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index 0bc11a6038383..4ab6076f5499e
> 100644
> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -455,7 +455,7 @@ static int rz_dmac_alloc_chan_resources(struct dma_chan *chan)
> if (!channel->descs_allocated)
> return -ENOMEM;
>
> - return channel->descs_allocated;
> + return pm_runtime_get_sync(chan->device->dev);
I would check for pm_runtime_resume_and_get(chan->device->dev) first
If successful, still will return channel->descs_allocated to comply with API documentation
rather than returning "runtime PM status"
@device_alloc_chan_resources: allocate resources and return the
number of allocated descriptors.
Cheers,
Biju
Powered by blists - more mailing lists