[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230415103601.2979-11-jszhang@kernel.org>
Date: Sat, 15 Apr 2023 18:36:00 +0800
From: Jisheng Zhang <jszhang@...nel.org>
To: Eugeniy Paltsev <Eugeniy.Paltsev@...opsys.com>,
Vinod Koul <vkoul@...nel.org>
Cc: dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2 10/11] dmaengine: dw-axi-dmac: move dma_chan_tx_status()
We will add polled support soon, for which we need to call
dw_axi_dma_handle_ch() in dma_chan_tx_status(). Move the function
to avoid pre-declaration.
No functionality changes.
Signed-off-by: Jisheng Zhang <jszhang@...nel.org>
---
.../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 84 +++++++++----------
1 file changed, 42 insertions(+), 42 deletions(-)
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index 1c1b9574985a..1d00793a83bf 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -300,48 +300,6 @@ static void vchan_desc_put(struct virt_dma_desc *vdesc)
axi_desc_put(vd_to_axi_desc(vdesc));
}
-static enum dma_status
-dma_chan_tx_status(struct dma_chan *dchan, dma_cookie_t cookie,
- struct dma_tx_state *txstate)
-{
- struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan);
- struct axi_dma_desc *desc = NULL;
- struct virt_dma_desc *vdesc;
- enum dma_status status;
- u32 completed_length;
- unsigned long flags;
- u32 completed_blocks;
- size_t bytes = 0;
- u32 length;
- u32 len;
-
- status = dma_cookie_status(dchan, cookie, txstate);
- if (status == DMA_COMPLETE || !txstate)
- return status;
-
- spin_lock_irqsave(&chan->vc.lock, flags);
-
- vdesc = vchan_find_desc(&chan->vc, cookie);
- if (vdesc) {
- desc = vd_to_axi_desc(vdesc);
- } else if (chan->desc && chan->desc->vd.tx.cookie == cookie) {
- desc = chan->desc;
- }
-
- if (desc) {
- length = desc->length;
- completed_blocks = desc->completed_blocks;
- len = desc->hw_desc[0].len;
- completed_length = completed_blocks * len;
- bytes = length - completed_length;
- }
-
- spin_unlock_irqrestore(&chan->vc.lock, flags);
- dma_set_residue(txstate, bytes);
-
- return status;
-}
-
static void write_desc_llp(struct axi_dma_hw_desc *desc, dma_addr_t adr)
{
desc->lli->llp = cpu_to_le64(adr);
@@ -1166,6 +1124,48 @@ static irqreturn_t dw_axi_dma_ch_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static enum dma_status
+dma_chan_tx_status(struct dma_chan *dchan, dma_cookie_t cookie,
+ struct dma_tx_state *txstate)
+{
+ struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan);
+ struct axi_dma_desc *desc = NULL;
+ struct virt_dma_desc *vdesc;
+ enum dma_status status;
+ u32 completed_length;
+ unsigned long flags;
+ u32 completed_blocks;
+ size_t bytes = 0;
+ u32 length;
+ u32 len;
+
+ status = dma_cookie_status(dchan, cookie, txstate);
+ if (status == DMA_COMPLETE || !txstate)
+ return status;
+
+ spin_lock_irqsave(&chan->vc.lock, flags);
+
+ vdesc = vchan_find_desc(&chan->vc, cookie);
+ if (vdesc) {
+ desc = vd_to_axi_desc(vdesc);
+ } else if (chan->desc && chan->desc->vd.tx.cookie == cookie) {
+ desc = chan->desc;
+ }
+
+ if (desc) {
+ length = desc->length;
+ completed_blocks = desc->completed_blocks;
+ len = desc->hw_desc[0].len;
+ completed_length = completed_blocks * len;
+ bytes = length - completed_length;
+ }
+
+ spin_unlock_irqrestore(&chan->vc.lock, flags);
+ dma_set_residue(txstate, bytes);
+
+ return status;
+}
+
static int dma_chan_terminate_all(struct dma_chan *dchan)
{
struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan);
--
2.39.2
Powered by blists - more mailing lists