Skip to content

Commit 9814ec1

Browse files
Villemoestorvalds
authored andcommitted
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>
1 parent f6a1f5d commit 9814ec1

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎include/linux/bitmap.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ extern int bitmap_parselist(const char *buf, unsigned long *maskp,
160160
extern int bitmap_parselist_user(const char __user *ubuf, unsigned int ulen,
161161
unsigned long *dst, int nbits);
162162
extern 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);
164164
extern int bitmap_bitremap(int oldbit,
165165
const unsigned long *old, const unsigned long *new, int bits);
166166
extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,

‎lib/bitmap.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ unsigned int bitmap_ord_to_pos(const unsigned long *buf, unsigned int ord, unsig
803803
* @src: subset to be remapped
804804
* @old: defines domain of map
805805
* @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
807807
*
808808
* Let @old and @new define a mapping of bit positions, such that
809809
* 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
831831
*/
832832
void bitmap_remap(unsigned long *dst, const unsigned long *src,
833833
const unsigned long *old, const unsigned long *new,
834-
int bits)
834+
unsigned int nbits)
835835
{
836-
int oldbit, w;
836+
unsigned int oldbit, w;
837837

838838
if (dst == src) /* following doesn't handle inplace remaps */
839839
return;
840-
bitmap_zero(dst, bits);
840+
bitmap_zero(dst, nbits);
841841

842-
w = bitmap_weight(new, bits);
843-
for_each_set_bit(oldbit, src, bits) {
844-
int n = bitmap_pos_to_ord(old, oldbit, bits);
842+
w = bitmap_weight(new, nbits);
843+
for_each_set_bit(oldbit, src, nbits) {
844+
int n = bitmap_pos_to_ord(old, oldbit, nbits);
845845

846846
if (n < 0 || w == 0)
847847
set_bit(oldbit, dst); /* identity map */
848848
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);
850850
}
851851
}
852852
EXPORT_SYMBOL(bitmap_remap);

0 commit comments

Comments
 (0)