提交 a7133a15 编写于 作者: A Andrew Morton 提交者: Linus Torvalds

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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 9a3be324
...@@ -331,7 +331,6 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir) ...@@ -331,7 +331,6 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
* request and allocate a buffer from that IO TLB pool. * request and allocate a buffer from that IO TLB pool.
*/ */
spin_lock_irqsave(&io_tlb_lock, flags); spin_lock_irqsave(&io_tlb_lock, flags);
{
index = ALIGN(io_tlb_index, stride); index = ALIGN(io_tlb_index, stride);
if (index >= io_tlb_nslabs) if (index >= io_tlb_nslabs)
index = 0; index = 0;
...@@ -348,23 +347,22 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir) ...@@ -348,23 +347,22 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
} }
/* /*
* If we find a slot that indicates we have 'nslots' * If we find a slot that indicates we have 'nslots' number of
* number of contiguous buffers, we allocate the * contiguous buffers, we allocate the buffers from that slot
* buffers from that slot and mark the entries as '0' * and mark the entries as '0' indicating unavailable.
* indicating unavailable.
*/ */
if (io_tlb_list[index] >= nslots) { if (io_tlb_list[index] >= nslots) {
int count = 0; int count = 0;
for (i = index; i < (int) (index + nslots); i++) for (i = index; i < (int) (index + nslots); i++)
io_tlb_list[i] = 0; io_tlb_list[i] = 0;
for (i = index - 1; (OFFSET(i, IO_TLB_SEGSIZE) != IO_TLB_SEGSIZE -1) && io_tlb_list[i]; i--) for (i = index - 1; (OFFSET(i, IO_TLB_SEGSIZE) != IO_TLB_SEGSIZE - 1) && io_tlb_list[i]; i--)
io_tlb_list[i] = ++count; io_tlb_list[i] = ++count;
dma_addr = io_tlb_start + (index << IO_TLB_SHIFT); dma_addr = io_tlb_start + (index << IO_TLB_SHIFT);
/* /*
* Update the indices to avoid searching in * Update the indices to avoid searching in the next
* the next round. * round.
*/ */
io_tlb_index = ((index + nslots) < io_tlb_nslabs io_tlb_index = ((index + nslots) < io_tlb_nslabs
? (index + nslots) : 0); ? (index + nslots) : 0);
...@@ -376,11 +374,10 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir) ...@@ -376,11 +374,10 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
index = 0; index = 0;
} while (index != wrap); } while (index != wrap);
not_found: not_found:
spin_unlock_irqrestore(&io_tlb_lock, flags); spin_unlock_irqrestore(&io_tlb_lock, flags);
return NULL; return NULL;
} found:
found:
spin_unlock_irqrestore(&io_tlb_lock, flags); spin_unlock_irqrestore(&io_tlb_lock, flags);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册