aboutsummaryrefslogtreecommitdiff
path: root/include/linux/iommu-helper.h
diff options
context:
space:
mode:
authorChristoph Hellwig2018-04-03 15:41:07 +0200
committerChristoph Hellwig2018-05-09 06:55:44 +0200
commit79c1879ee5473e3404469b07f9bccfe6d0814b93 (patch)
tree7dfd4e224cd8bf1e4790ba8505fd25569f019155 /include/linux/iommu-helper.h
parent33782714dc53cfb9b8b02e852f3d239e5820cf42 (diff)
iommu-helper: mark iommu_is_span_boundary as inline
This avoids selecting IOMMU_HELPER just for this function. And we only use it once or twice in normal builds so this often even is a size reduction. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include/linux/iommu-helper.h')
-rw-r--r--include/linux/iommu-helper.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index cb9a9248c8c0..70d01edcbf8b 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_IOMMU_HELPER_H
#define _LINUX_IOMMU_HELPER_H
+#include <linux/bug.h>
#include <linux/kernel.h>
static inline unsigned long iommu_device_max_index(unsigned long size,
@@ -14,9 +15,15 @@ static inline unsigned long iommu_device_max_index(unsigned long size,
return size;
}
-extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
- unsigned long shift,
- unsigned long boundary_size);
+static inline int iommu_is_span_boundary(unsigned int index, unsigned int nr,
+ unsigned long shift, unsigned long boundary_size)
+{
+ BUG_ON(!is_power_of_2(boundary_size));
+
+ shift = (shift + index) & (boundary_size - 1);
+ return shift + nr > boundary_size;
+}
+
extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
unsigned long start, unsigned int nr,
unsigned long shift,