Commit 3b8bee2a authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Vinod Koul

dmaengine: ti: k3-udma: Do not use ring_get_occ in udma_pop_from_ring

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: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Link: https://lore.kernel.org/r/20200707102352.28773-3-peter.ujfalusi@ti.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 2166d960
...@@ -588,7 +588,7 @@ static bool udma_desc_is_rx_flush(struct udma_chan *uc, dma_addr_t addr) ...@@ -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) static int udma_pop_from_ring(struct udma_chan *uc, dma_addr_t *addr)
{ {
struct k3_ring *ring = NULL; struct k3_ring *ring = NULL;
int ret = -ENOENT; int ret;
switch (uc->config.dir) { switch (uc->config.dir) {
case DMA_DEV_TO_MEM: case DMA_DEV_TO_MEM:
...@@ -599,26 +599,24 @@ static int udma_pop_from_ring(struct udma_chan *uc, dma_addr_t *addr) ...@@ -599,26 +599,24 @@ static int udma_pop_from_ring(struct udma_chan *uc, dma_addr_t *addr)
ring = uc->tchan->tc_ring; ring = uc->tchan->tc_ring;
break; break;
default: default:
break; return -ENOENT;
} }
if (ring && k3_ringacc_ring_get_occ(ring)) { ret = k3_ringacc_ring_pop(ring, addr);
ret = k3_ringacc_ring_pop(ring, addr); if (ret)
if (ret) return 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 */ /* Teardown completion */
if (cppi5_desc_is_tdcm(*addr)) if (cppi5_desc_is_tdcm(*addr))
return ret; return 0;
/* Check for flush descriptor */ /* Check for flush descriptor */
if (udma_desc_is_rx_flush(uc, *addr)) if (udma_desc_is_rx_flush(uc, *addr))
return -ENOENT; return -ENOENT;
}
return ret; return 0;
} }
static void udma_reset_rings(struct udma_chan *uc) static void udma_reset_rings(struct udma_chan *uc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment