2022-05-04 18:25:19

by Amelie Delaunay

[permalink] [raw]
Subject: [PATCH 0/3] STM32 MDMA IRQ handler code cleaning

This patchset cleans stm32-mdma interrupt handler:
- GISR1 register is not used on any STM32 SoC with MDMA
- Remove chan wrong initialization
- Lower the log level to debug instead of warn in case of spurious it
on stopped channel

Amelie Delaunay (3):
dmaengine: stm32-mdma: remove GISR1 register
dmaengine: stm32-mdma: fix chan initialization in
stm32_mdma_irq_handler()
dmaengine: stm32-mdma: use dev_dbg on non-busy channel spurious it

drivers/dma/stm32-mdma.c | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)

--
2.25.1



2022-05-06 00:03:42

by Amelie Delaunay

[permalink] [raw]
Subject: [PATCH 2/3] dmaengine: stm32-mdma: fix chan initialization in stm32_mdma_irq_handler()

The parameter to pass back to the handler function when irq has been
requested is a struct stm32_mdma_device pointer, not a struct
stm32_mdma_chan pointer.
Even if chan is reinit later in the function, remove this wrong
initialization.

Fixes: a4ffb13c8946 ("dmaengine: Add STM32 MDMA driver")
Signed-off-by: Amelie Delaunay <[email protected]>
---
drivers/dma/stm32-mdma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
index 57f0eb8a18fc..a5cbfbbb93d1 100644
--- a/drivers/dma/stm32-mdma.c
+++ b/drivers/dma/stm32-mdma.c
@@ -1318,7 +1318,7 @@ static void stm32_mdma_xfer_end(struct stm32_mdma_chan *chan)
static irqreturn_t stm32_mdma_irq_handler(int irq, void *devid)
{
struct stm32_mdma_device *dmadev = devid;
- struct stm32_mdma_chan *chan = devid;
+ struct stm32_mdma_chan *chan;
u32 reg, id, ccr, ien, status;

/* Find out which channel generates the interrupt */
--
2.25.1


2022-05-08 10:52:08

by Amelie Delaunay

[permalink] [raw]
Subject: [PATCH 3/3] dmaengine: stm32-mdma: use dev_dbg on non-busy channel spurious it

If interrupt occurs while !chan->busy, it means channel has been disabled
between the raise of the interruption and the read of status and ien, so,
spurious interrupt can be silently discarded.

Signed-off-by: Amelie Delaunay <[email protected]>
---
drivers/dma/stm32-mdma.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
index a5cbfbbb93d1..caf0cce8f528 100644
--- a/drivers/dma/stm32-mdma.c
+++ b/drivers/dma/stm32-mdma.c
@@ -1345,9 +1345,12 @@ static irqreturn_t stm32_mdma_irq_handler(int irq, void *devid)

if (!(status & ien)) {
spin_unlock(&chan->vchan.lock);
- dev_warn(chan2dev(chan),
- "spurious it (status=0x%04x, ien=0x%04x)\n",
- status, ien);
+ if (chan->busy)
+ dev_warn(chan2dev(chan),
+ "spurious it (status=0x%04x, ien=0x%04x)\n", status, ien);
+ else
+ dev_dbg(chan2dev(chan),
+ "spurious it (status=0x%04x, ien=0x%04x)\n", status, ien);
return IRQ_NONE;
}

--
2.25.1


2022-05-23 08:07:09

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 0/3] STM32 MDMA IRQ handler code cleaning

On 04-05-22, 17:53, Amelie Delaunay wrote:
> This patchset cleans stm32-mdma interrupt handler:
> - GISR1 register is not used on any STM32 SoC with MDMA
> - Remove chan wrong initialization
> - Lower the log level to debug instead of warn in case of spurious it
> on stopped channel

Applied, thanks

--
~Vinod