mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ata: pata_pxa: fix the inverted DMA completion timeout check 
@ 2026-10-31 14:20 shao.mingyin
  2026-11-02 16:13 ` Niklas Cassel
  0 siblings, 1 reply; 2+ messages in thread
From: shao.mingyin @ 2026-10-31 14:20 UTC (permalink / raw)
  To: dlemoal, cassel, linux-ide; +Cc: linux-kernel

From: Shao Mingyin <shao.mingyin@zte.com.cn>

pxa_bmdma_stop() waits for the DMA completion that pxa_ata_dma_irq()
signals and reports a timeout when the wait fails.  The condition is
inverted: wait_for_completion_timeout() returns zero on timeout, but the
driver prints "Timeout waiting for DMA completion!" when the return value
is non-zero, that is when the DMA actually completed.  A real timeout is
silent.

Negate the wait so that the error is reported only when the completion
does not arrive.  The condition has been inverted since the driver was
added, the dmaengine conversion kept it.

Fixes: 2dc6c6f15da9 ("[ARM] pata_pxa: DMA-capable PATA driver")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
index a694f6a178e3..f041e6adc9d1 100644
--- a/drivers/ata/pata_pxa.c
+++ b/drivers/ata/pata_pxa.c
@@ -95,9 +95,9 @@ static void pxa_bmdma_stop(struct ata_queued_cmd *qc)
 	enum dma_status status;

 	status = dmaengine_tx_status(pd->dma_chan, pd->dma_cookie, NULL);
 	if (status != DMA_ERROR && status != DMA_COMPLETE &&
-	    wait_for_completion_timeout(&pd->dma_done, HZ))
+	    !wait_for_completion_timeout(&pd->dma_done, HZ))
 		ata_dev_err(qc->dev, "Timeout waiting for DMA completion!");

 	dmaengine_terminate_all(pd->dma_chan);
 }

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

* Re: [PATCH] ata: pata_pxa: fix the inverted DMA completion timeout check
  2026-10-31 14:20 [PATCH] ata: pata_pxa: fix the inverted DMA completion timeout check shao.mingyin
@ 2026-11-02 16:13 ` Niklas Cassel
  0 siblings, 0 replies; 2+ messages in thread
From: Niklas Cassel @ 2026-11-02 16:13 UTC (permalink / raw)
  To: dlemoal, linux-ide, shao.mingyin; +Cc: Niklas Cassel, linux-kernel

On Sat, 31 Oct 2026 22:20:02 +0800, shao.mingyin@zte.com.cn wrote:
> pxa_bmdma_stop() waits for the DMA completion that pxa_ata_dma_irq()
> signals and reports a timeout when the wait fails.  The condition is
> inverted: wait_for_completion_timeout() returns zero on timeout, but the
> driver prints "Timeout waiting for DMA completion!" when the return value
> is non-zero, that is when the DMA actually completed.  A real timeout is
> silent.
> 
> [...]

Since Linus prefers receiving untested AI patches during the merge window:
https://lore.kernel.org/lkml/CAHk-=whOCnAwXz-FMRdQEDJQ+9b2YXh9M=GHgRay0o4cxSmPVg@mail.gmail.com/


Applied to libata/linux.git (for-7.5), thanks!

[1/1] ata: pata_pxa: fix the inverted DMA completion timeout check
      https://git.kernel.org/libata/linux/c/aa99a446

Kind regards,
Niklas

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

end of thread, other threads:[~2026-11-02 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31 14:20 [PATCH] ata: pata_pxa: fix the inverted DMA completion timeout check shao.mingyin
2026-11-02 16:13 ` Niklas Cassel

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®