Skip to content

Commit 9b6c2d2

Browse files
Villemoestorvalds
authored andcommitted
lib/bitmap.c: change prototype of bitmap_copy_le
Make the prototype of bitmap_copy_le the same as bitmap_copy's. All other bitmap_* functions take unsigned long* parameters; there's no reason this should be special. The only current user is the static inline uwb_mas_bm_copy_le, which already does the void* laundering, so the end users can pass their u8 or __le32 buffers without a cast. Furthermore, this allows us to simply let bitmap_copy_le be an alias for bitmap_copy on little-endian; see next patch. 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 db3ecde commit 9b6c2d2

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

‎include/linux/bitmap.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
170170
extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
171171
extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
172172
extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
173-
extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
173+
extern void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits);
174174
extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int ord, unsigned int nbits);
175175
extern int bitmap_print_to_pagebuf(bool list, char *buf,
176176
const unsigned long *maskp, int nmaskbits);

‎lib/bitmap.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,16 +1191,15 @@ EXPORT_SYMBOL(bitmap_allocate_region);
11911191
*
11921192
* Require nbits % BITS_PER_LONG == 0.
11931193
*/
1194-
void bitmap_copy_le(void *dst, const unsigned long *src, int nbits)
1194+
void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits)
11951195
{
1196-
unsigned long *d = dst;
1197-
int i;
1196+
unsigned int i;
11981197

11991198
for (i = 0; i < nbits/BITS_PER_LONG; i++) {
12001199
if (BITS_PER_LONG == 64)
1201-
d[i] = cpu_to_le64(src[i]);
1200+
dst[i] = cpu_to_le64(src[i]);
12021201
else
1203-
d[i] = cpu_to_le32(src[i]);
1202+
dst[i] = cpu_to_le32(src[i]);
12041203
}
12051204
}
12061205
EXPORT_SYMBOL(bitmap_copy_le);

0 commit comments

Comments
 (0)