diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index 64d1b638745d63bc0ac7569427e583db3236a0cc..86bdeffe43ad69e3dba2781eeed06b8cbe847a69 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h @@ -1,6 +1,8 @@ #ifndef _LINUX_IOMMU_HELPER_H #define _LINUX_IOMMU_HELPER_H +#include <linux/kernel.h> + static inline unsigned long iommu_device_max_index(unsigned long size, unsigned long offset, u64 dma_mask) @@ -20,7 +22,13 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, unsigned long boundary_size, unsigned long align_mask); -extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, - unsigned long io_page_size); +static inline unsigned long iommu_num_pages(unsigned long addr, + unsigned long len, + unsigned long io_page_size) +{ + unsigned long size = (addr & (io_page_size - 1)) + len; + + return DIV_ROUND_UP(size, io_page_size); +} #endif diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index c0251f4ad08b05fec688f97ea2e771095cfdb89c..da053313ee5c089e099d02c9a368eb4f4aacaf56 100644 --- a/lib/iommu-helper.c +++ b/lib/iommu-helper.c @@ -38,12 +38,3 @@ unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, return -1; } EXPORT_SYMBOL(iommu_area_alloc); - -unsigned long iommu_num_pages(unsigned long addr, unsigned long len, - unsigned long io_page_size) -{ - unsigned long size = (addr & (io_page_size - 1)) + len; - - return DIV_ROUND_UP(size, io_page_size); -} -EXPORT_SYMBOL(iommu_num_pages);