mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
swiotlb: use iommu_is_span_boundary helper function
iommu_is_span_boundary in lib/iommu-helper.c was exported for PARISC IOMMUs
(commit 3715863aa1). SWIOTLB can use it instead
of the homegrown function.
Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Tony Luck <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
a7133a1558
commit
a852250920
3 changed files with 9 additions and 15 deletions
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <linux/init.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/iommu-helper.h>
|
||||
|
||||
#define OFFSET(val,align) ((unsigned long) \
|
||||
( (val) & ( (align) - 1)))
|
||||
|
|
@ -282,15 +283,6 @@ address_needs_mapping(struct device *hwdev, dma_addr_t addr)
|
|||
return (addr & ~mask) != 0;
|
||||
}
|
||||
|
||||
static inline unsigned int is_span_boundary(unsigned int index,
|
||||
unsigned int nslots,
|
||||
unsigned long offset_slots,
|
||||
unsigned long max_slots)
|
||||
{
|
||||
unsigned long offset = (offset_slots + index) & (max_slots - 1);
|
||||
return offset + nslots > max_slots;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocates bounce buffer and returns its kernel virtual address.
|
||||
*/
|
||||
|
|
@ -337,8 +329,8 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
|
|||
wrap = index;
|
||||
|
||||
do {
|
||||
while (is_span_boundary(index, nslots, offset_slots,
|
||||
max_slots)) {
|
||||
while (iommu_is_span_boundary(index, nslots, offset_slots,
|
||||
max_slots)) {
|
||||
index += stride;
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue