lib/swiotlb.c: cleanups
There's a pointlessly braced block of code in there. Remove the braces and save a tabstop. Cc: Andi Kleen <ak@suse.de> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Jan Beulich <jbeulich@novell.com> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9a3be324e3
commit
a7133a1558
1 changed files with 42 additions and 45 deletions
|
@ -331,56 +331,53 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
|
|||
* request and allocate a buffer from that IO TLB pool.
|
||||
*/
|
||||
spin_lock_irqsave(&io_tlb_lock, flags);
|
||||
{
|
||||
index = ALIGN(io_tlb_index, stride);
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
wrap = index;
|
||||
index = ALIGN(io_tlb_index, stride);
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
wrap = index;
|
||||
|
||||
do {
|
||||
while (is_span_boundary(index, nslots, offset_slots,
|
||||
max_slots)) {
|
||||
index += stride;
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
if (index == wrap)
|
||||
goto not_found;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 (io_tlb_list[index] >= nslots) {
|
||||
int count = 0;
|
||||
|
||||
for (i = index; i < (int) (index + nslots); i++)
|
||||
io_tlb_list[i] = 0;
|
||||
for (i = index - 1; (OFFSET(i, IO_TLB_SEGSIZE) != IO_TLB_SEGSIZE -1) && io_tlb_list[i]; i--)
|
||||
io_tlb_list[i] = ++count;
|
||||
dma_addr = io_tlb_start + (index << IO_TLB_SHIFT);
|
||||
|
||||
/*
|
||||
* Update the indices to avoid searching in
|
||||
* the next round.
|
||||
*/
|
||||
io_tlb_index = ((index + nslots) < io_tlb_nslabs
|
||||
? (index + nslots) : 0);
|
||||
|
||||
goto found;
|
||||
}
|
||||
do {
|
||||
while (is_span_boundary(index, nslots, offset_slots,
|
||||
max_slots)) {
|
||||
index += stride;
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
} while (index != wrap);
|
||||
if (index == wrap)
|
||||
goto not_found;
|
||||
}
|
||||
|
||||
not_found:
|
||||
spin_unlock_irqrestore(&io_tlb_lock, flags);
|
||||
return NULL;
|
||||
}
|
||||
found:
|
||||
/*
|
||||
* 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 (io_tlb_list[index] >= nslots) {
|
||||
int count = 0;
|
||||
|
||||
for (i = index; i < (int) (index + nslots); i++)
|
||||
io_tlb_list[i] = 0;
|
||||
for (i = index - 1; (OFFSET(i, IO_TLB_SEGSIZE) != IO_TLB_SEGSIZE - 1) && io_tlb_list[i]; i--)
|
||||
io_tlb_list[i] = ++count;
|
||||
dma_addr = io_tlb_start + (index << IO_TLB_SHIFT);
|
||||
|
||||
/*
|
||||
* Update the indices to avoid searching in the next
|
||||
* round.
|
||||
*/
|
||||
io_tlb_index = ((index + nslots) < io_tlb_nslabs
|
||||
? (index + nslots) : 0);
|
||||
|
||||
goto found;
|
||||
}
|
||||
index += stride;
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
} while (index != wrap);
|
||||
|
||||
not_found:
|
||||
spin_unlock_irqrestore(&io_tlb_lock, flags);
|
||||
return NULL;
|
||||
found:
|
||||
spin_unlock_irqrestore(&io_tlb_lock, flags);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue