[v1,1/2] swiotlb: Use wrap_area_index() instead of open-coding it

Message ID 5c7da4c21a8ba72422567dd157533d062b75024c.1679382779.git.petr.tesarik.ext@huawei.com
State New
Headers
Series swiotlb: Cleanup and alignment fix |

Commit Message

Petr Tesarik March 21, 2023, 8:31 a.m. UTC
  From: Petr Tesarik <petr.tesarik.ext@huawei.com>

No functional change, just use an existing helper.

Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
---
 kernel/dma/swiotlb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Patch

diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 91454b513db0..3856e2b524b4 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -695,10 +695,7 @@  static int swiotlb_do_find_slots(struct device *dev, int area_index,
 	/*
 	 * Update the indices to avoid searching in the next round.
 	 */
-	if (index + nslots < mem->area_nslabs)
-		area->index = index + nslots;
-	else
-		area->index = 0;
+	area->index = wrap_area_index(mem, index + nslots);
 	area->used += nslots;
 	spin_unlock_irqrestore(&area->lock, flags);
 	return slot_index;