Re: [PATCH 3/3] dma: fsl_raid: use devm_platform_ioremap_resource
From: Frank Li
Date: Thu Jul 16 2026 - 12:54:13 EST
On Tue, Jul 14, 2026 at 04:38:55PM -0700, Rosen Penev wrote:
> Replace the open-coded platform_get_resource() plus devm_ioremap()
> sequence with devm_platform_ioremap_resource(), which fetches the
> resource, requests the region and maps it in one call. Switch the error
> check to IS_ERR()/PTR_ERR() and drop the now-unused struct resource
> pointer.
>
> The raideng node has a single reg region (0x320000, 0x10000); the
> job-queue/ring children are separate OF devices probed independently, so
> the region reservation added by devm_ioremap_resource() is exclusive and
> does not introduce overlap failures.
>
> Assisted-by: opencode:hy3-free
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> drivers/dma/fsl_raid.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/fsl_raid.c b/drivers/dma/fsl_raid.c
> index 47ebdf274331..aadb3dcb1b03 100644
> --- a/drivers/dma/fsl_raid.c
> +++ b/drivers/dma/fsl_raid.c
> @@ -747,24 +747,20 @@ static int fsl_re_probe(struct platform_device *ofdev)
> u32 off;
> u8 ridx = 0;
> struct dma_device *dma_dev;
> - struct resource *res;
> struct fsl_re_ctrl __iomem *re_regs;
> int rc;
> struct device *dev = &ofdev->dev;
>
> + /* IOMAP the entire RAID Engine region */
> + re_regs = devm_platform_ioremap_resource(ofdev, 0);
> + if (IS_ERR(re_regs))
> + return PTR_ERR(re_regs);
> +
> re_priv = devm_kzalloc(dev, sizeof(*re_priv), GFP_KERNEL);
> if (!re_priv)
> return -ENOMEM;
>
> - res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -ENODEV;
> -
> - /* IOMAP the entire RAID Engine region */
> - re_priv->re_regs = devm_ioremap(dev, res->start, resource_size(res));
> - if (!re_priv->re_regs)
> - return -EBUSY;
> - re_regs = re_priv->re_regs;
> + re_priv->re_regs = re_regs;
>
> /* Program the RE mode */
> out_be32(&re_regs->global_config, FSL_RE_NON_DPAA_MODE);
> --
> 2.55.0
>