diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2015-02-12 18:02:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 21:54:14 -0500 |
commit | 9814ec135dedb70a9daa41e68798d540d7ba71f2 (patch) | |
tree | 858d7cf2fda770e3331b33d554bee8f503a6eb27 /lib/bitmap.c | |
parent | f6a1f5db8d7a7a94ff07251996959d27daba4ee7 (diff) |
lib/bitmap.c: make the bits parameter of bitmap_remap unsigned
Also, rename bits to nbits. Both changes for consistency with other
bitmap_* functions.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r-- | lib/bitmap.c | 16 |
1 files changed, 8 insertions, 8 deletions
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 | */ |
832 | void bitmap_remap(unsigned long *dst, const unsigned long *src, | 832 | void 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 | } |
852 | EXPORT_SYMBOL(bitmap_remap); | 852 | EXPORT_SYMBOL(bitmap_remap); |