X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fbitmap.c;h=1338469ac849cb230fc8f1e74441ece4a6cfd58c;hb=765426e8ee4c0ab2bc9d44951f4865b8494cdbd0;hp=482df94ea21eb3e9ab7b2ef4efe88643147c3d80;hpb=72441bdc76f7f71d7b75cdaa48f26dbb1f3d932e;p=linux-2.6-omap-h63xx.git diff --git a/lib/bitmap.c b/lib/bitmap.c index 482df94ea21..1338469ac84 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -996,3 +996,25 @@ int bitmap_allocate_region(unsigned long *bitmap, int pos, int order) return 0; } EXPORT_SYMBOL(bitmap_allocate_region); + +/** + * bitmap_copy_le - copy a bitmap, putting the bits into little-endian order. + * @dst: destination buffer + * @src: bitmap to copy + * @nbits: number of bits in the bitmap + * + * Require nbits % BITS_PER_LONG == 0. + */ +void bitmap_copy_le(void *dst, const unsigned long *src, int nbits) +{ + unsigned long *d = dst; + int i; + + for (i = 0; i < nbits/BITS_PER_LONG; i++) { + if (BITS_PER_LONG == 64) + d[i] = cpu_to_le64(src[i]); + else + d[i] = cpu_to_le32(src[i]); + } +} +EXPORT_SYMBOL(bitmap_copy_le);