mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: at_hdmac: ioremap and get irq early
@ 2026-07-23  5:06 Rosen Penev
  2026-08-19 19:50 ` Frank Li
  0 siblings, 1 reply; 3+ messages in thread
From: Rosen Penev @ 2026-07-23  5:06 UTC (permalink / raw)
  To: dmaengine
  Cc: Ludovic Desroches, Vinod Koul, Frank Li,
	moderated list:MICROCHIP AT91 DMA DRIVERS, open list

The functions can return -EPROBE_DEFER. Call them before anything else
to avoid doing extra work.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/dma/at_hdmac.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index e5b30a57c477..2f6f5877fc3c 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1943,11 +1943,20 @@ static void at_dma_off(struct at_dma *atdma)
 static int __init at_dma_probe(struct platform_device *pdev)
 {
 	struct at_dma		*atdma;
+	void __iomem		*regs;
 	int			irq;
 	int			err;
 	int			i;
 	const struct at_dma_platform_data *plat_dat;
 
+	regs = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(regs))
+		return PTR_ERR(regs);
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
 	/* setup platform data for each SoC */
 	dma_cap_set(DMA_MEMCPY, at91sam9rl_config.cap_mask);
 	dma_cap_set(DMA_INTERLEAVE, at91sam9g45_config.cap_mask);
@@ -1968,13 +1977,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	if (!atdma)
 		return -ENOMEM;
 
-	atdma->regs = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(atdma->regs))
-		return PTR_ERR(atdma->regs);
-
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return irq;
+	atdma->regs = regs;
 
 	/* discover transaction capabilities */
 	atdma->dma_device.cap_mask = plat_dat->cap_mask;
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: ioremap and get irq early
  2026-07-23  5:06 [PATCH] dmaengine: at_hdmac: ioremap and get irq early Rosen Penev
@ 2026-08-19 19:50 ` Frank Li
  2026-08-20 18:38   ` Rosen Penev
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2026-08-19 19:50 UTC (permalink / raw)
  To: Rosen Penev
  Cc: dmaengine, Ludovic Desroches, Vinod Koul, Frank Li,
	moderated list:MICROCHIP AT91 DMA DRIVERS, open list

On Wed, Jul 22, 2026 at 10:06:06PM -0700, Rosen Penev wrote:
> The functions can return -EPROBE_DEFER. Call them before anything else
> to avoid doing extra work.

just move before one devm_kalloc(), I have not seen much beanfit for it.

Frank

>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  drivers/dma/at_hdmac.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e5b30a57c477..2f6f5877fc3c 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1943,11 +1943,20 @@ static void at_dma_off(struct at_dma *atdma)
>  static int __init at_dma_probe(struct platform_device *pdev)
>  {
>  	struct at_dma		*atdma;
> +	void __iomem		*regs;
>  	int			irq;
>  	int			err;
>  	int			i;
>  	const struct at_dma_platform_data *plat_dat;
>
> +	regs = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(regs))
> +		return PTR_ERR(regs);
> +
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq < 0)
> +		return irq;
> +
>  	/* setup platform data for each SoC */
>  	dma_cap_set(DMA_MEMCPY, at91sam9rl_config.cap_mask);
>  	dma_cap_set(DMA_INTERLEAVE, at91sam9g45_config.cap_mask);
> @@ -1968,13 +1977,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	if (!atdma)
>  		return -ENOMEM;
>
> -	atdma->regs = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(atdma->regs))
> -		return PTR_ERR(atdma->regs);
> -
> -	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0)
> -		return irq;
> +	atdma->regs = regs;
>
>  	/* discover transaction capabilities */
>  	atdma->dma_device.cap_mask = plat_dat->cap_mask;
> --
> 2.55.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: ioremap and get irq early
  2026-08-19 19:50 ` Frank Li
@ 2026-08-20 18:38   ` Rosen Penev
  0 siblings, 0 replies; 3+ messages in thread
From: Rosen Penev @ 2026-08-20 18:38 UTC (permalink / raw)
  To: Frank Li
  Cc: dmaengine, Ludovic Desroches, Vinod Koul, Frank Li,
	moderated list:MICROCHIP AT91 DMA DRIVERS, open list

On Wed, Aug 19, 2026 at 12:50 PM Frank Li <Frank.li@oss.nxp.com> wrote:
>
> On Wed, Jul 22, 2026 at 10:06:06PM -0700, Rosen Penev wrote:
> > The functions can return -EPROBE_DEFER. Call them before anything else
> > to avoid doing extra work.
>
> just move before one devm_kalloc(), I have not seen much beanfit for it.
Not sure I follow. devm_platform_ioremap_resource() and
platform_get_irq() just need a platform_device pointer.
>
> Frank
>
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> >  drivers/dma/at_hdmac.c | 17 ++++++++++-------
> >  1 file changed, 10 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> > index e5b30a57c477..2f6f5877fc3c 100644
> > --- a/drivers/dma/at_hdmac.c
> > +++ b/drivers/dma/at_hdmac.c
> > @@ -1943,11 +1943,20 @@ static void at_dma_off(struct at_dma *atdma)
> >  static int __init at_dma_probe(struct platform_device *pdev)
> >  {
> >       struct at_dma           *atdma;
> > +     void __iomem            *regs;
> >       int                     irq;
> >       int                     err;
> >       int                     i;
> >       const struct at_dma_platform_data *plat_dat;
> >
> > +     regs = devm_platform_ioremap_resource(pdev, 0);
> > +     if (IS_ERR(regs))
> > +             return PTR_ERR(regs);
> > +
> > +     irq = platform_get_irq(pdev, 0);
> > +     if (irq < 0)
> > +             return irq;
> > +
> >       /* setup platform data for each SoC */
> >       dma_cap_set(DMA_MEMCPY, at91sam9rl_config.cap_mask);
> >       dma_cap_set(DMA_INTERLEAVE, at91sam9g45_config.cap_mask);
> > @@ -1968,13 +1977,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
> >       if (!atdma)
> >               return -ENOMEM;
> >
> > -     atdma->regs = devm_platform_ioremap_resource(pdev, 0);
> > -     if (IS_ERR(atdma->regs))
> > -             return PTR_ERR(atdma->regs);
> > -
> > -     irq = platform_get_irq(pdev, 0);
> > -     if (irq < 0)
> > -             return irq;
> > +     atdma->regs = regs;
> >
> >       /* discover transaction capabilities */
> >       atdma->dma_device.cap_mask = plat_dat->cap_mask;
> > --
> > 2.55.0
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-20 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-23  5:06 [PATCH] dmaengine: at_hdmac: ioremap and get irq early Rosen Penev
2026-08-19 19:50 ` Frank Li
2026-08-20 18:38   ` Rosen Penev

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®