aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r--include/linux/bitops.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index c537ac7435ad..4cac4e1a72ff 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -228,6 +228,30 @@ static inline unsigned long __ffs64(u64 word)
228 return __ffs((unsigned long)word); 228 return __ffs((unsigned long)word);
229} 229}
230 230
231/**
232 * assign_bit - Assign value to a bit in memory
233 * @nr: the bit to set
234 * @addr: the address to start counting from
235 * @value: the value to assign
236 */
237static __always_inline void assign_bit(long nr, volatile unsigned long *addr,
238 bool value)
239{
240 if (value)
241 set_bit(nr, addr);
242 else
243 clear_bit(nr, addr);
244}
245
246static __always_inline void __assign_bit(long nr, volatile unsigned long *addr,
247 bool value)
248{
249 if (value)
250 __set_bit(nr, addr);
251 else
252 __clear_bit(nr, addr);
253}
254
231#ifdef __KERNEL__ 255#ifdef __KERNEL__
232 256
233#ifndef set_mask_bits 257#ifndef set_mask_bits