summaryrefslogtreecommitdiffstats
path: root/kernel/dma
diff options
context:
space:
mode:
authorPetr Tesarik <petr.tesarik.ext@huawei.com>2023-08-02 18:30:34 +0200
committerChristoph Hellwig <hch@lst.de>2023-08-08 10:29:06 -0700
commitf94cb36e760d2a4d359ad64f5fafc62ca755fd72 (patch)
tree80360c9e57b832efb78c95a8a145744bf419b953 /kernel/dma
parent1395706a14904f2593debecf20f827e72d7392a7 (diff)
downloadlinux-f94cb36e760d2a4d359ad64f5fafc62ca755fd72.tar.gz
linux-f94cb36e760d2a4d359ad64f5fafc62ca755fd72.tar.bz2
linux-f94cb36e760d2a4d359ad64f5fafc62ca755fd72.zip
swiotlb: move slot allocation explanation comment where it belongs
Move the comment down in front of the loop that actually sets the list member of struct io_tlb_slot to zero. Fixes: 26a7e094783d ("swiotlb: refactor swiotlb_tbl_map_single") Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'kernel/dma')
-rw-r--r--kernel/dma/swiotlb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index d7eac84f975b..50a0e9c45c39 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -1018,11 +1018,6 @@ static int swiotlb_area_find_slots(struct device *dev, struct io_tlb_pool *pool,
continue;
}
- /*
- * If we find a slot that indicates we have 'nslots' number of
- * contiguous buffers, we allocate the buffers from that slot
- * and mark the entries as '0' indicating unavailable.
- */
if (!iommu_is_span_boundary(slot_index, nslots,
nr_slots(tbl_dma_addr),
max_slots)) {
@@ -1038,6 +1033,11 @@ not_found:
return -1;
found:
+ /*
+ * If we find a slot that indicates we have 'nslots' number of
+ * contiguous buffers, we allocate the buffers from that slot onwards
+ * and set the list of free entries to '0' indicating unavailable.
+ */
for (i = slot_index; i < slot_index + nslots; i++) {
pool->slots[i].list = 0;
pool->slots[i].alloc_size = alloc_size - (offset +