diff options
author | David S. Miller <davem@davemloft.net> | 2008-03-18 02:44:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-18 02:44:31 -0400 |
commit | 2f633928cbba8a5858bb39b11e7219a41b0fbef5 (patch) | |
tree | 9a82f4b7f2c3afe4b0208d8e44ea61bae90a7d22 /lib/iommu-helper.c | |
parent | 5e226e4d9016daee170699f8a4188a5505021756 (diff) | |
parent | bde4f8fa8db2abd5ac9c542d76012d0fedab050f (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'lib/iommu-helper.c')
-rw-r--r-- | lib/iommu-helper.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index 495575a59ca6..a3b8d4c3f77a 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, | |||
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | static inline int is_span_boundary(unsigned int index, unsigned int nr, | 43 | int iommu_is_span_boundary(unsigned int index, unsigned int nr, |
44 | unsigned long shift, | 44 | unsigned long shift, |
45 | unsigned long boundary_size) | 45 | unsigned long boundary_size) |
46 | { | 46 | { |
47 | BUG_ON(!is_power_of_2(boundary_size)); | ||
48 | |||
47 | shift = (shift + index) & (boundary_size - 1); | 49 | shift = (shift + index) & (boundary_size - 1); |
48 | return shift + nr > boundary_size; | 50 | return shift + nr > boundary_size; |
49 | } | 51 | } |
@@ -57,7 +59,7 @@ unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | |||
57 | again: | 59 | again: |
58 | index = find_next_zero_area(map, size, start, nr, align_mask); | 60 | index = find_next_zero_area(map, size, start, nr, align_mask); |
59 | if (index != -1) { | 61 | if (index != -1) { |
60 | if (is_span_boundary(index, nr, shift, boundary_size)) { | 62 | if (iommu_is_span_boundary(index, nr, shift, boundary_size)) { |
61 | /* we could do more effectively */ | 63 | /* we could do more effectively */ |
62 | start = index + 1; | 64 | start = index + 1; |
63 | goto again; | 65 | goto again; |