Skip to content

Commit 9efd5df

Browse files
Jianxiong Gaogregkh
authored andcommitted
swiotlb: clean up swiotlb_tbl_unmap_single
commit: ca10d0f swiotlb: clean up swiotlb_tbl_unmap_single Remove a layer of pointless indentation, replace a hard to follow ternary expression with a plain if/else. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Jianxiong Gao <jxgao@google.com> Tested-by: Jianxiong Gao <jxgao@google.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Jianxiong Gao <jxgao@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1f2ef5a commit 9efd5df

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

‎kernel/dma/swiotlb.c‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -610,28 +610,29 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr,
610610
* with slots below and above the pool being returned.
611611
*/
612612
spin_lock_irqsave(&io_tlb_lock, flags);
613-
{
614-
count = ((index + nslots) < ALIGN(index + 1, IO_TLB_SEGSIZE) ?
615-
io_tlb_list[index + nslots] : 0);
616-
/*
617-
* Step 1: return the slots to the free list, merging the
618-
* slots with superceeding slots
619-
*/
620-
for (i = index + nslots - 1; i >= index; i--) {
621-
io_tlb_list[i] = ++count;
622-
io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
623-
}
624-
/*
625-
* Step 2: merge the returned slots with the preceding slots,
626-
* if available (non zero)
627-
*/
628-
for (i = index - 1;
629-
io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 &&
630-
io_tlb_list[i]; i--)
631-
io_tlb_list[i] = ++count;
613+
if (index + nslots < ALIGN(index + 1, IO_TLB_SEGSIZE))
614+
count = io_tlb_list[index + nslots];
615+
else
616+
count = 0;
632617

633-
io_tlb_used -= nslots;
618+
/*
619+
* Step 1: return the slots to the free list, merging the slots with
620+
* superceeding slots
621+
*/
622+
for (i = index + nslots - 1; i >= index; i--) {
623+
io_tlb_list[i] = ++count;
624+
io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
634625
}
626+
627+
/*
628+
* Step 2: merge the returned slots with the preceding slots, if
629+
* available (non zero)
630+
*/
631+
for (i = index - 1;
632+
io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 && io_tlb_list[i];
633+
i--)
634+
io_tlb_list[i] = ++count;
635+
io_tlb_used -= nslots;
635636
spin_unlock_irqrestore(&io_tlb_lock, flags);
636637
}
637638

0 commit comments

Comments
 (0)