diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2024-08-30 15:14:29 +0300 |
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2024-08-30 16:00:53 +0300 |
| commit | 3973a8d052829dcc5193fb6330dcd13c2b7127ca (patch) | |
| tree | b02f355e874ec5997196dfea09ad796419c38e7d /include/linux/bitmap.h | |
| parent | e75356ef5baef69e9f577023c453d91a902dc082 (diff) | |
| parent | 6d0ebb3904853d18eeec7af5e8b4ca351b6f9025 (diff) | |
| download | linux-3973a8d052829dcc5193fb6330dcd13c2b7127ca.tar.xz | |
Merge drm/drm-next into drm-misc-next
Backmerging to get fixes from v6.11-rc5.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
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. |
