diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-08-19 06:16:49 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-08-19 06:16:49 +0200 |
| commit | ca7df2c7bb5f83fe46aa9ce998b7352c6b28f3a1 (patch) | |
| tree | f0304a9068bea0b80ba7ed07c0192927c6fcea8f /include/linux/bitmap.h | |
| parent | 82313624b2ae5a943d16475a566b65c873989e9f (diff) | |
| parent | 47ac09b91befbb6a235ab620c32af719f8208399 (diff) | |
Merge 6.11-rc4 into usb-next
We need the usb / thunderbolt fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/bitmap.h')
| -rw-r--r-- | include/linux/bitmap.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 8c4768c44a01..d3b66d77df7a 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -270,6 +270,18 @@ static inline void bitmap_copy_clear_tail(unsigned long *dst, dst[nbits / BITS_PER_LONG] &= BITMAP_LAST_WORD_MASK(nbits); } +static inline void bitmap_copy_and_extend(unsigned long *to, + const unsigned long *from, + unsigned int count, unsigned int size) +{ + unsigned int copy = BITS_TO_LONGS(count); + + memcpy(to, from, copy * sizeof(long)); + if (count % BITS_PER_LONG) + to[copy - 1] &= BITMAP_LAST_WORD_MASK(count); + memset(to + copy, 0, bitmap_size(size) - copy * sizeof(long)); +} + /* * On 32-bit systems bitmaps are represented as u32 arrays internally. On LE64 * machines the order of hi and lo parts of numbers match the bitmap structure. |
