From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: tomm.merciai@gmail.com, linux-renesas-soc@vger.kernel.org,
biju.das.jz@bp.renesas.com, "Vinod Koul" <vkoul@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Fabrizio Castro" <fabrizio.castro.jz@renesas.com>,
"Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>,
"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] dmaengine: sh: rz-dmac: Use devm_add_action_or_reset()
Date: Fri, 5 Sep 2025 17:22:53 +0200 [thread overview]
Message-ID: <aLsATdoqct8JfgYz@tom-desktop> (raw)
In-Reply-To: <1b2d2410dd9c300da1ffe015ed4835208416798b.camel@pengutronix.de>
Hi Philipp,
Thank you for your review!
On Fri, Sep 05, 2025 at 04:53:54PM +0200, Philipp Zabel wrote:
> On Fr, 2025-09-05 at 16:44 +0200, Tommaso Merciai wrote:
> > Slightly simplify rz_dmac_probe() by using devm_add_action_or_reset()
> > for reset cleanup.
> >
> > Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > ---
> > drivers/dma/sh/rz-dmac.c | 13 +++++++++++--
> > 1 file changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
> > index 0b526cc4d24be..0bc11a6038383 100644
> > --- a/drivers/dma/sh/rz-dmac.c
> > +++ b/drivers/dma/sh/rz-dmac.c
> > @@ -905,6 +905,11 @@ static int rz_dmac_parse_of(struct device *dev, struct rz_dmac *dmac)
> > return rz_dmac_parse_of_icu(dev, dmac);
> > }
> >
> > +static void rz_dmac_reset_control_assert(void *data)
> > +{
> > + reset_control_assert(data);
> > +}
> > +
> > static int rz_dmac_probe(struct platform_device *pdev)
> > {
> > const char *irqname = "error";
> > @@ -977,6 +982,12 @@ static int rz_dmac_probe(struct platform_device *pdev)
> > if (ret)
> > goto err_pm_runtime_put;
> >
> > + ret = devm_add_action_or_reset(&pdev->dev,
> > + rz_dmac_reset_control_assert,
> > + dmac->rstc);
> > + if (ret)
> > + goto err_pm_runtime_put;
> > +
> > for (i = 0; i < dmac->n_channels; i++) {
> > ret = rz_dmac_chan_probe(dmac, &dmac->channels[i], i);
> > if (ret < 0)
> > @@ -1031,7 +1042,6 @@ static int rz_dmac_probe(struct platform_device *pdev)
> > channel->lmdesc.base_dma);
> > }
> >
> > - reset_control_assert(dmac->rstc);
> > err_pm_runtime_put:
> > pm_runtime_put(&pdev->dev);
> >
> > @@ -1053,7 +1063,6 @@ static void rz_dmac_remove(struct platform_device *pdev)
> > channel->lmdesc.base,
> > channel->lmdesc.base_dma);
> > }
> > - reset_control_assert(dmac->rstc);
>
> This patch changes cleanup order by effectively moving the
> reset_control_assert() after pm_runtime_put(). The commit message does
> not explain that this is safe to do.
Agreed. Thanks.
>
> If this is ok, I'd move the reset_control_assert() up before
> pm_runtime_enable/resume_and_get().
You mean having in the end the following calls:
...
dmac->rstc = devm_reset_control_array_get_optional_exclusive(&pdev->dev);
if (IS_ERR(dmac->rstc))
return dev_err_probe(&pdev->dev, PTR_ERR(dmac->rstc),
"failed to get resets\n");
ret = reset_control_deassert(dmac->rstc);
if (ret)
return dev_err_probe(&pdev->dev, ret,
"failed to deassert resets\n");
ret = devm_add_action_or_reset(&pdev->dev,
rz_dmac_reset_control_assert,
dmac->rstc);
if (ret)
return dev_err_probe(&pdev->dev, ret,
"failed to register reset cleanup action\n");
ret = devm_pm_runtime_enable(&pdev->dev);
if (ret < 0)
return dev_err_probe(&pdev->dev, ret,
"Failed to enable runtime PM\n");
...
Right?
Thanks in advance.
Kind Regards,
Tommaso
>
> regards
> Philipp
next prev parent reply other threads:[~2025-09-05 15:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 14:44 [PATCH 0/4] dmaengine: sh: rz-dmac: Add system sleep PM support Tommaso Merciai
2025-09-05 14:44 ` [PATCH 1/4] dmaengine: sh: rz-dmac: Use devm_pm_runtime_enable() Tommaso Merciai
2025-09-05 14:44 ` [PATCH 2/4] dmaengine: sh: rz-dmac: Use devm_add_action_or_reset() Tommaso Merciai
2025-09-05 14:53 ` Philipp Zabel
2025-09-05 15:22 ` Tommaso Merciai [this message]
2025-09-05 15:30 ` Philipp Zabel
2025-09-05 14:44 ` [PATCH 3/4] dmaengine: sh: rz-dmac: Refactor runtime PM handling Tommaso Merciai
2025-09-05 16:17 ` Biju Das
2026-01-12 9:30 ` Claudiu Beznea
2025-09-05 14:44 ` [PATCH 4/4] dmaengine: sh: rz-dmac: Add system sleep power management Tommaso Merciai
2025-09-05 15:36 ` [PATCH 0/4] dmaengine: sh: rz-dmac: Add system sleep PM support Tommaso Merciai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aLsATdoqct8JfgYz@tom-desktop \
--to=tommaso.merciai.xr@bp.renesas.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=dmaengine@vger.kernel.org \
--cc=fabrizio.castro.jz@renesas.com \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=tomm.merciai@gmail.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=vkoul@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox