[PATCH 1/8] iommu-helper: Simplify find_next_zero_area

From: Akinobu Mita
Date: Fri Oct 09 2009 - 04:38:25 EST


Use find_next_bit instead of doing test_bit for each bit

Cc: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
---
lib/iommu-helper.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c
index 75dbda0..dddbf22 100644
--- a/lib/iommu-helper.c
+++ b/lib/iommu-helper.c
@@ -21,11 +21,10 @@ again:
end = index + nr;
if (end >= size)
return -1;
- for (i = index; i < end; i++) {
- if (test_bit(i, map)) {
- start = i+1;
- goto again;
- }
+ i = find_next_bit(map, end, index);
+ if (i < end) {
+ start = i + 1;
+ goto again;
}
return index;
}
--
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/