From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Vinod Koul <vkoul@kernel.org>,
Tudor Ambarus <tudor.ambarus@microchip.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/2] at_hdmac: check and return DMA_PAUSED status when suitable
Date: Tue, 8 Nov 2022 09:49:37 +0200 [thread overview]
Message-ID: <20221108074938.48853-1-andriy.shevchenko@linux.intel.com> (raw)
device_tx_status() may return DMA_PAUSED status when driver supports it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/dma/at_hdmac.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 8858470246e1..a9d8dd990d6e 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1669,9 +1669,19 @@ atc_tx_status(struct dma_chan *chan,
int ret;
dma_status = dma_cookie_status(chan, cookie, txstate);
- if (dma_status == DMA_COMPLETE || !txstate)
+ if (dma_status == DMA_COMPLETE)
return dma_status;
+ /*
+ * There's no point in calculating the residue if there's
+ * no txstate to store the value.
+ */
+ if (!txstate) {
+ if (test_bit(ATC_IS_PAUSED, &atchan->status))
+ return DMA_PAUSED;
+ return DMA_ERROR;
+ }
+
spin_lock_irqsave(&atchan->vc.lock, flags);
/* Get number of bytes left in the active transactions */
ret = atc_get_residue(chan, cookie, &residue);
@@ -1684,6 +1694,9 @@ atc_tx_status(struct dma_chan *chan,
dma_set_residue(txstate, residue);
}
+ if (test_bit(ATC_IS_PAUSED, &atchan->status))
+ dma_status = DMA_PAUSED;
+
dev_vdbg(chan2dev(chan), "tx_status %d: cookie = %d residue = %u\n",
dma_status, cookie, residue);
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2022-11-08 7:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 7:49 Andy Shevchenko [this message]
2022-11-08 7:49 ` [PATCH v1 2/2] at_hdmac: return actual status when txstatus parameter is NULL Andy Shevchenko
2022-11-08 11:51 ` Tudor.Ambarus
2022-11-08 11:50 ` [PATCH v1 1/2] at_hdmac: check and return DMA_PAUSED status when suitable Tudor.Ambarus
2022-11-08 12:18 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221108074938.48853-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=nicolas.ferre@microchip.com \
--cc=tudor.ambarus@microchip.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).