From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: <vkoul@kernel.org>
Cc: <dmaengine@vger.kernel.org>, <dan.j.williams@intel.com>,
<grygorii.strashko@ti.com>
Subject: [PATCH v2 2/5] dmaengine: ti: k3-udma: Do not use ring_get_occ in udma_pop_from_ring
Date: Tue, 7 Jul 2020 13:23:49 +0300 [thread overview]
Message-ID: <20200707102352.28773-3-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <20200707102352.28773-1-peter.ujfalusi@ti.com>
The ring_get_occ is redundant as the k3_ringacc_ring_pop() is also
checking the occ of the ring.
With removing the ring_get_occ, the function can be simplified as well.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/dma/ti/k3-udma.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 919669634d87..c2b3792bed54 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -588,7 +588,7 @@ static bool udma_desc_is_rx_flush(struct udma_chan *uc, dma_addr_t addr)
static int udma_pop_from_ring(struct udma_chan *uc, dma_addr_t *addr)
{
struct k3_ring *ring = NULL;
- int ret = -ENOENT;
+ int ret;
switch (uc->config.dir) {
case DMA_DEV_TO_MEM:
@@ -599,26 +599,24 @@ static int udma_pop_from_ring(struct udma_chan *uc, dma_addr_t *addr)
ring = uc->tchan->tc_ring;
break;
default:
- break;
+ return -ENOENT;
}
- if (ring && k3_ringacc_ring_get_occ(ring)) {
- ret = k3_ringacc_ring_pop(ring, addr);
- if (ret)
- return ret;
+ ret = k3_ringacc_ring_pop(ring, addr);
+ if (ret)
+ return ret;
- rmb(); /* Ensure that reads are not moved before this point */
+ rmb(); /* Ensure that reads are not moved before this point */
- /* Teardown completion */
- if (cppi5_desc_is_tdcm(*addr))
- return ret;
+ /* Teardown completion */
+ if (cppi5_desc_is_tdcm(*addr))
+ return 0;
- /* Check for flush descriptor */
- if (udma_desc_is_rx_flush(uc, *addr))
- return -ENOENT;
- }
+ /* Check for flush descriptor */
+ if (udma_desc_is_rx_flush(uc, *addr))
+ return -ENOENT;
- return ret;
+ return 0;
}
static void udma_reset_rings(struct udma_chan *uc)
--
Peter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
next prev parent reply other threads:[~2020-07-07 10:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 10:23 [PATCH v2 0/5] dmaengine: ti: k3-udma: cleanups for 5.8 Peter Ujfalusi
2020-07-07 10:23 ` [PATCH v2 1/5] dmaengine: ti: k3-udma: Remove dma_sync_single calls for descriptors Peter Ujfalusi
2020-07-07 10:23 ` Peter Ujfalusi [this message]
2020-07-07 10:23 ` [PATCH v2 3/5] dmaengine: ti: k3-udma: Use common defines for TCHANRT/RCHANRT registers Peter Ujfalusi
2020-07-07 10:23 ` [PATCH v2 4/5] dmaengine: ti: k3-udma-private: Use udma_read/write for register access Peter Ujfalusi
2020-07-07 10:23 ` [PATCH v2 5/5] dmaengine: ti: k3-udma: Use udma_chan instead of tchan/rchan for IO functions Peter Ujfalusi
2020-07-07 12:57 ` [PATCH v2 0/5] dmaengine: ti: k3-udma: cleanups for 5.8 Grygorii Strashko
2020-07-15 6:07 ` Vinod Koul
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=20200707102352.28773-3-peter.ujfalusi@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=grygorii.strashko@ti.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).