X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fiommu-helper.c;h=a3b8d4c3f77a5e7e466bd8f5e5591f3dcaa2c3bd;hb=eb53e9f3ea859a6d59c37b500593b970aa8562e6;hp=495575a59ca643f752a2314b44e5e0e77a2963f5;hpb=4f4ae0d42680889c62db4e1f3e6b4aa7787a7257;p=linux-2.6-omap-h63xx.git diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index 495575a59ca..a3b8d4c3f77 100644 --- a/lib/iommu-helper.c +++ b/lib/iommu-helper.c @@ -40,10 +40,12 @@ static inline void set_bit_area(unsigned long *map, unsigned long i, } } -static inline int is_span_boundary(unsigned int index, unsigned int nr, - unsigned long shift, - unsigned long boundary_size) +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; } @@ -57,7 +59,7 @@ unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, again: index = find_next_zero_area(map, size, start, nr, align_mask); if (index != -1) { - if (is_span_boundary(index, nr, shift, boundary_size)) { + if (iommu_is_span_boundary(index, nr, shift, boundary_size)) { /* we could do more effectively */ start = index + 1; goto again;