diff options
-rw-r--r-- | include/linux/iommu-helper.h | 12 | ||||
-rw-r--r-- | lib/iommu-helper.c | 9 |
2 files changed, 10 insertions, 11 deletions
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index 64d1b638745d..86bdeffe43ad 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _LINUX_IOMMU_HELPER_H | 1 | #ifndef _LINUX_IOMMU_HELPER_H |
2 | #define _LINUX_IOMMU_HELPER_H | 2 | #define _LINUX_IOMMU_HELPER_H |
3 | 3 | ||
4 | #include <linux/kernel.h> | ||
5 | |||
4 | static inline unsigned long iommu_device_max_index(unsigned long size, | 6 | static inline unsigned long iommu_device_max_index(unsigned long size, |
5 | unsigned long offset, | 7 | unsigned long offset, |
6 | u64 dma_mask) | 8 | u64 dma_mask) |
@@ -20,7 +22,13 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | |||
20 | unsigned long boundary_size, | 22 | unsigned long boundary_size, |
21 | unsigned long align_mask); | 23 | unsigned long align_mask); |
22 | 24 | ||
23 | extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, | 25 | static inline unsigned long iommu_num_pages(unsigned long addr, |
24 | unsigned long io_page_size); | 26 | unsigned long len, |
27 | unsigned long io_page_size) | ||
28 | { | ||
29 | unsigned long size = (addr & (io_page_size - 1)) + len; | ||
30 | |||
31 | return DIV_ROUND_UP(size, io_page_size); | ||
32 | } | ||
25 | 33 | ||
26 | #endif | 34 | #endif |
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index c0251f4ad08b..da053313ee5c 100644 --- a/lib/iommu-helper.c +++ b/lib/iommu-helper.c | |||
@@ -38,12 +38,3 @@ again: | |||
38 | return -1; | 38 | return -1; |
39 | } | 39 | } |
40 | EXPORT_SYMBOL(iommu_area_alloc); | 40 | EXPORT_SYMBOL(iommu_area_alloc); |
41 | |||
42 | unsigned long iommu_num_pages(unsigned long addr, unsigned long len, | ||
43 | unsigned long io_page_size) | ||
44 | { | ||
45 | unsigned long size = (addr & (io_page_size - 1)) + len; | ||
46 | |||
47 | return DIV_ROUND_UP(size, io_page_size); | ||
48 | } | ||
49 | EXPORT_SYMBOL(iommu_num_pages); | ||