Skip to content

Commit 801db90

Browse files
ambarusvinodkoul
authored andcommitted
dmaengine: at_xdmac: Move the free desc to the tail of the desc list
Move the free desc to the tail of the list, so that the sequence of descriptors is more track-able in case of debug. One would know which descriptor should come next and could easier catch concurrency over descriptors for example. virt-dma uses list_splice_tail_init() as well, follow the core driver. Signed-off-by: Tudor Ambarus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent b63e5cb commit 801db90

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

drivers/dma/at_xdmac.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,8 @@ at_xdmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
729729
if (!desc) {
730730
dev_err(chan2dev(chan), "can't get descriptor\n");
731731
if (first)
732-
list_splice_init(&first->descs_list, &atchan->free_descs_list);
732+
list_splice_tail_init(&first->descs_list,
733+
&atchan->free_descs_list);
733734
goto spin_unlock;
734735
}
735736

@@ -817,7 +818,8 @@ at_xdmac_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr,
817818
if (!desc) {
818819
dev_err(chan2dev(chan), "can't get descriptor\n");
819820
if (first)
820-
list_splice_init(&first->descs_list, &atchan->free_descs_list);
821+
list_splice_tail_init(&first->descs_list,
822+
&atchan->free_descs_list);
821823
spin_unlock_irqrestore(&atchan->lock, irqflags);
822824
return NULL;
823825
}
@@ -1051,8 +1053,8 @@ at_xdmac_prep_interleaved(struct dma_chan *chan,
10511053
src_addr, dst_addr,
10521054
xt, chunk);
10531055
if (!desc) {
1054-
list_splice_init(&first->descs_list,
1055-
&atchan->free_descs_list);
1056+
list_splice_tail_init(&first->descs_list,
1057+
&atchan->free_descs_list);
10561058
return NULL;
10571059
}
10581060

@@ -1132,7 +1134,8 @@ at_xdmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
11321134
if (!desc) {
11331135
dev_err(chan2dev(chan), "can't get descriptor\n");
11341136
if (first)
1135-
list_splice_init(&first->descs_list, &atchan->free_descs_list);
1137+
list_splice_tail_init(&first->descs_list,
1138+
&atchan->free_descs_list);
11361139
return NULL;
11371140
}
11381141

@@ -1308,8 +1311,8 @@ at_xdmac_prep_dma_memset_sg(struct dma_chan *chan, struct scatterlist *sgl,
13081311
sg_dma_len(sg),
13091312
value);
13101313
if (!desc && first)
1311-
list_splice_init(&first->descs_list,
1312-
&atchan->free_descs_list);
1314+
list_splice_tail_init(&first->descs_list,
1315+
&atchan->free_descs_list);
13131316

13141317
if (!first)
13151318
first = desc;
@@ -1701,7 +1704,8 @@ static void at_xdmac_tasklet(struct tasklet_struct *t)
17011704

17021705
spin_lock_irq(&atchan->lock);
17031706
/* Move the xfer descriptors into the free descriptors list. */
1704-
list_splice_init(&desc->descs_list, &atchan->free_descs_list);
1707+
list_splice_tail_init(&desc->descs_list,
1708+
&atchan->free_descs_list);
17051709
at_xdmac_advance_work(atchan);
17061710
spin_unlock_irq(&atchan->lock);
17071711
}
@@ -1850,7 +1854,8 @@ static int at_xdmac_device_terminate_all(struct dma_chan *chan)
18501854
/* Cancel all pending transfers. */
18511855
list_for_each_entry_safe(desc, _desc, &atchan->xfers_list, xfer_node) {
18521856
list_del(&desc->xfer_node);
1853-
list_splice_init(&desc->descs_list, &atchan->free_descs_list);
1857+
list_splice_tail_init(&desc->descs_list,
1858+
&atchan->free_descs_list);
18541859
}
18551860

18561861
clear_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status);

0 commit comments

Comments
 (0)