Commit ca10d0f8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Konrad Rzeszutek Wilk

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: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarJianxiong Gao <jxgao@google.com>
Tested-by: default avatarJianxiong Gao <jxgao@google.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent c32a77fd
...@@ -626,28 +626,29 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr, ...@@ -626,28 +626,29 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr,
* with slots below and above the pool being returned. * with slots below and above the pool being returned.
*/ */
spin_lock_irqsave(&io_tlb_lock, flags); spin_lock_irqsave(&io_tlb_lock, flags);
{ if (index + nslots < ALIGN(index + 1, IO_TLB_SEGSIZE))
count = ((index + nslots) < ALIGN(index + 1, IO_TLB_SEGSIZE) ? count = io_tlb_list[index + nslots];
io_tlb_list[index + nslots] : 0); else
count = 0;
/* /*
* Step 1: return the slots to the free list, merging the * Step 1: return the slots to the free list, merging the slots with
* slots with superceeding slots * superceeding slots
*/ */
for (i = index + nslots - 1; i >= index; i--) { for (i = index + nslots - 1; i >= index; i--) {
io_tlb_list[i] = ++count; io_tlb_list[i] = ++count;
io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
} }
/* /*
* Step 2: merge the returned slots with the preceding slots, * Step 2: merge the returned slots with the preceding slots, if
* if available (non zero) * available (non zero)
*/ */
for (i = index - 1; for (i = index - 1;
io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 && io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 && io_tlb_list[i];
io_tlb_list[i]; i--) i--)
io_tlb_list[i] = ++count; io_tlb_list[i] = ++count;
io_tlb_used -= nslots; io_tlb_used -= nslots;
}
spin_unlock_irqrestore(&io_tlb_lock, flags); spin_unlock_irqrestore(&io_tlb_lock, flags);
} }
......
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