* [PATCH] dmaengine: txx9dmac: use devm_platform_ioremap_resource()
@ 2026-07-14 23:47 Rosen Penev
2026-08-19 19:55 ` Frank Li
2026-09-03 17:04 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Rosen Penev @ 2026-07-14 23:47 UTC (permalink / raw)
To: dmaengine; +Cc: Vinod Koul, Frank Li, open list
Replace the open-coded platform_get_resource() plus devm_request_mem_region()
and devm_ioremap() sequence with a single devm_platform_ioremap_resource()
call, which folds the resource lookup, region reservation and mapping into
one step and returns an ERR_PTR on failure, checked with IS_ERR() and
propagated via PTR_ERR().
This is behaviorally equivalent: the driver already reserved the region
with devm_request_mem_region(), so the non-overlapping reg requirement of
devm_platform_ioremap_resource() was already satisfied. The txx9dmac
platform device (arch/mips/txx9/generic/setup.c) provides a single
IORESOURCE_MEM window per DMAC instance, and the child txx9dmac-chan
devices carry only IRQ resources, so no region conflict is introduced.
Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/dma/txx9dmac.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c
index 05622b68a936..6595a54a4b97 100644
--- a/drivers/dma/txx9dmac.c
+++ b/drivers/dma/txx9dmac.c
@@ -1167,26 +1167,20 @@ static void txx9dmac_chan_remove(struct platform_device *pdev)
static int __init txx9dmac_probe(struct platform_device *pdev)
{
struct txx9dmac_platform_data *pdata = dev_get_platdata(&pdev->dev);
- struct resource *io;
struct txx9dmac_dev *ddev;
+ void __iomem *regs;
u32 mcr;
int err;
- io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!io)
- return -EINVAL;
+ regs = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(regs))
+ return PTR_ERR(regs);
ddev = devm_kzalloc(&pdev->dev, sizeof(*ddev), GFP_KERNEL);
if (!ddev)
return -ENOMEM;
- if (!devm_request_mem_region(&pdev->dev, io->start, resource_size(io),
- dev_name(&pdev->dev)))
- return -EBUSY;
-
- ddev->regs = devm_ioremap(&pdev->dev, io->start, resource_size(io));
- if (!ddev->regs)
- return -ENOMEM;
+ ddev->regs = regs;
ddev->have_64bit_regs = pdata->have_64bit_regs;
if (__is_dmac64(ddev))
ddev->descsize = sizeof(struct txx9dmac_hwdesc);
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dmaengine: txx9dmac: use devm_platform_ioremap_resource()
2026-07-14 23:47 [PATCH] dmaengine: txx9dmac: use devm_platform_ioremap_resource() Rosen Penev
@ 2026-08-19 19:55 ` Frank Li
2026-09-03 17:04 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-08-19 19:55 UTC (permalink / raw)
To: Rosen Penev; +Cc: dmaengine, Vinod Koul, Frank Li, open list
On Tue, Jul 14, 2026 at 04:47:42PM -0700, Rosen Penev wrote:
> Replace the open-coded platform_get_resource() plus devm_request_mem_region()
> and devm_ioremap() sequence with a single devm_platform_ioremap_resource()
> call, which folds the resource lookup, region reservation and mapping into
> one step and returns an ERR_PTR on failure, checked with IS_ERR() and
> propagated via PTR_ERR().
>
> This is behaviorally equivalent: the driver already reserved the region
> with devm_request_mem_region(), so the non-overlapping reg requirement of
> devm_platform_ioremap_resource() was already satisfied. The txx9dmac
> platform device (arch/mips/txx9/generic/setup.c) provides a single
> IORESOURCE_MEM window per DMAC instance, and the child txx9dmac-chan
> devices carry only IRQ resources, so no region conflict is introduced.
>
> Assisted-by: opencode:hy3-free
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/txx9dmac.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c
> index 05622b68a936..6595a54a4b97 100644
> --- a/drivers/dma/txx9dmac.c
> +++ b/drivers/dma/txx9dmac.c
> @@ -1167,26 +1167,20 @@ static void txx9dmac_chan_remove(struct platform_device *pdev)
> static int __init txx9dmac_probe(struct platform_device *pdev)
> {
> struct txx9dmac_platform_data *pdata = dev_get_platdata(&pdev->dev);
> - struct resource *io;
> struct txx9dmac_dev *ddev;
> + void __iomem *regs;
> u32 mcr;
> int err;
>
> - io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!io)
> - return -EINVAL;
> + regs = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(regs))
> + return PTR_ERR(regs);
>
> ddev = devm_kzalloc(&pdev->dev, sizeof(*ddev), GFP_KERNEL);
> if (!ddev)
> return -ENOMEM;
>
> - if (!devm_request_mem_region(&pdev->dev, io->start, resource_size(io),
> - dev_name(&pdev->dev)))
> - return -EBUSY;
> -
> - ddev->regs = devm_ioremap(&pdev->dev, io->start, resource_size(io));
> - if (!ddev->regs)
> - return -ENOMEM;
> + ddev->regs = regs;
> ddev->have_64bit_regs = pdata->have_64bit_regs;
> if (__is_dmac64(ddev))
> ddev->descsize = sizeof(struct txx9dmac_hwdesc);
> --
> 2.55.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dmaengine: txx9dmac: use devm_platform_ioremap_resource()
2026-07-14 23:47 [PATCH] dmaengine: txx9dmac: use devm_platform_ioremap_resource() Rosen Penev
2026-08-19 19:55 ` Frank Li
@ 2026-09-03 17:04 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2026-09-03 17:04 UTC (permalink / raw)
To: dmaengine, Rosen Penev; +Cc: Frank Li, linux-kernel
On Tue, 14 Jul 2026 16:47:42 -0700, Rosen Penev wrote:
> Replace the open-coded platform_get_resource() plus devm_request_mem_region()
> and devm_ioremap() sequence with a single devm_platform_ioremap_resource()
> call, which folds the resource lookup, region reservation and mapping into
> one step and returns an ERR_PTR on failure, checked with IS_ERR() and
> propagated via PTR_ERR().
>
> This is behaviorally equivalent: the driver already reserved the region
> with devm_request_mem_region(), so the non-overlapping reg requirement of
> devm_platform_ioremap_resource() was already satisfied. The txx9dmac
> platform device (arch/mips/txx9/generic/setup.c) provides a single
> IORESOURCE_MEM window per DMAC instance, and the child txx9dmac-chan
> devices carry only IRQ resources, so no region conflict is introduced.
>
> [...]
Applied, thanks!
[1/1] dmaengine: txx9dmac: use devm_platform_ioremap_resource()
commit: e99f446c47318f4489eb3a675d53d4047951a6d0
Best regards,
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-03 17:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-14 23:47 [PATCH] dmaengine: txx9dmac: use devm_platform_ioremap_resource() Rosen Penev
2026-08-19 19:55 ` Frank Li
2026-09-03 17:04 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®