diff options
author | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2024-12-27 00:33:08 +0000 |
---|---|---|
committer | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2025-01-31 16:00:48 +0000 |
commit | 3fd7fd4974c8000148360af2f02002f1c083681a (patch) | |
tree | e12e8ebb94e5ccc329e45dbae76b19527f854f62 | |
parent | 2da778e62e591fc8841a5395ce0b601b70144074 (diff) |
linuxkpi: Add `__assign_bit()`
[Why]
This function is used by the i915 DRM driver in Linux 6.7.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48752
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/bitops.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index 1415d5224084..23aabb546cb2 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -288,6 +288,15 @@ find_next_zero_bit(const unsigned long *addr, unsigned long size, #define test_bit(i, a) \ !!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)]) & BIT_MASK(i)) +static inline void +__assign_bit(long bit, volatile unsigned long *addr, bool value) +{ + if (value) + __set_bit(bit, addr); + else + __clear_bit(bit, addr); +} + static inline int test_and_clear_bit(long bit, volatile unsigned long *var) { |