diff options
| author | Takashi Iwai <tiwai@suse.de> | 2008-12-19 08:22:57 +0100 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2008-12-19 08:22:57 +0100 |
| commit | 0ff555192a8d20385d49d1c420e2e8d409b3c0da (patch) | |
| tree | b6e4b6cae1028a310a3488ebf745954c51694bfc /lib/bitmap.c | |
| parent | 3218c178b41b420cb7e0d120c7a137a3969242e5 (diff) | |
| parent | 9e43f0de690211cf7153b5f3ec251bc315647ada (diff) | |
Merge branch 'fix/hda' into topic/hda
Diffstat (limited to 'lib/bitmap.c')
| -rw-r--r-- | lib/bitmap.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index 06fb57c86de..1338469ac84 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -316,17 +316,6 @@ int bitmap_scnprintf(char *buf, unsigned int buflen, EXPORT_SYMBOL(bitmap_scnprintf); /** - * bitmap_scnprintf_len - return buffer length needed to convert - * bitmap to an ASCII hex string - * @nr_bits: number of bits to be converted - */ -int bitmap_scnprintf_len(unsigned int nr_bits) -{ - unsigned int nr_nibbles = ALIGN(nr_bits, 4) / 4; - return nr_nibbles + ALIGN(nr_nibbles, CHUNKSZ / 4) / (CHUNKSZ / 4) - 1; -} - -/** * __bitmap_parse - convert an ASCII hex string into a bitmap. * @buf: pointer to buffer containing string. * @buflen: buffer size in bytes. If string is smaller than this @@ -1007,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); |
