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@xxxxxxxxxxxxxx> > > --- > > 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