aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/bitmap.h2
-rw-r--r--lib/bitmap.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 1e74fe7aa167..5f5c00de39f0 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -160,7 +160,7 @@ extern int bitmap_parselist(const char *buf, unsigned long *maskp,
160extern int bitmap_parselist_user(const char __user *ubuf, unsigned int ulen, 160extern int bitmap_parselist_user(const char __user *ubuf, unsigned int ulen,
161 unsigned long *dst, int nbits); 161 unsigned long *dst, int nbits);
162extern void bitmap_remap(unsigned long *dst, const unsigned long *src, 162extern void bitmap_remap(unsigned long *dst, const unsigned long *src,
163 const unsigned long *old, const unsigned long *new, int bits); 163 const unsigned long *old, const unsigned long *new, unsigned int nbits);
164extern int bitmap_bitremap(int oldbit, 164extern int bitmap_bitremap(int oldbit,
165 const unsigned long *old, const unsigned long *new, int bits); 165 const unsigned long *old, const unsigned long *new, int bits);
166extern void bitmap_onto(unsigned long *dst, const unsigned long *orig, 166extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,
diff --git a/lib/bitmap.c b/lib/bitmap.c
index e8a38bde7af9..ad161a6c82db 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -803,7 +803,7 @@ unsigned int bitmap_ord_to_pos(const unsigned long *buf, unsigned int ord, unsig
803 * @src: subset to be remapped 803 * @src: subset to be remapped
804 * @old: defines domain of map 804 * @old: defines domain of map
805 * @new: defines range of map 805 * @new: defines range of map
806 * @bits: number of bits in each of these bitmaps 806 * @nbits: number of bits in each of these bitmaps
807 * 807 *
808 * Let @old and @new define a mapping of bit positions, such that 808 * Let @old and @new define a mapping of bit positions, such that
809 * whatever position is held by the n-th set bit in @old is mapped 809 * whatever position is held by the n-th set bit in @old is mapped
@@ -831,22 +831,22 @@ unsigned int bitmap_ord_to_pos(const unsigned long *buf, unsigned int ord, unsig
831 */ 831 */
832void bitmap_remap(unsigned long *dst, const unsigned long *src, 832void bitmap_remap(unsigned long *dst, const unsigned long *src,
833 const unsigned long *old, const unsigned long *new, 833 const unsigned long *old, const unsigned long *new,
834 int bits) 834 unsigned int nbits)
835{ 835{
836 int oldbit, w; 836 unsigned int oldbit, w;
837 837
838 if (dst == src) /* following doesn't handle inplace remaps */ 838 if (dst == src) /* following doesn't handle inplace remaps */
839 return; 839 return;
840 bitmap_zero(dst, bits); 840 bitmap_zero(dst, nbits);
841 841
842 w = bitmap_weight(new, bits); 842 w = bitmap_weight(new, nbits);
843 for_each_set_bit(oldbit, src, bits) { 843 for_each_set_bit(oldbit, src, nbits) {
844 int n = bitmap_pos_to_ord(old, oldbit, bits); 844 int n = bitmap_pos_to_ord(old, oldbit, nbits);
845 845
846 if (n < 0 || w == 0) 846 if (n < 0 || w == 0)
847 set_bit(oldbit, dst); /* identity map */ 847 set_bit(oldbit, dst); /* identity map */
848 else 848 else
849 set_bit(bitmap_ord_to_pos(new, n % w, bits), dst); 849 set_bit(bitmap_ord_to_pos(new, n % w, nbits), dst);
850 } 850 }
851} 851}
852EXPORT_SYMBOL(bitmap_remap); 852EXPORT_SYMBOL(bitmap_remap);