diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2017-11-09 09:38:42 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-11-09 09:38:42 +0100 |
commit | bee67c7c9d7d3252dce69c960a53e53fd6b04e09 (patch) | |
tree | e01f03a5c4530936c734508ec75ca82b37b484b8 /include/linux/bitops.h | |
parent | pinctrl: gemini: Fix GMAC groups (diff) | |
parent | pinctrl: bcm2835: Fix some merge fallout (diff) | |
download | linux-dev-bee67c7c9d7d3252dce69c960a53e53fd6b04e09.tar.xz linux-dev-bee67c7c9d7d3252dce69c960a53e53fd6b04e09.zip |
Merge branch 'gpio-irqchip-rework' of /home/linus/linux-gpio into devel
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r-- | include/linux/bitops.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 8fbe259b197c..9a874deee6e2 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -227,6 +227,30 @@ static inline unsigned long __ffs64(u64 word) return __ffs((unsigned long)word); } +/** + * assign_bit - Assign value to a bit in memory + * @nr: the bit to set + * @addr: the address to start counting from + * @value: the value to assign + */ +static __always_inline void assign_bit(long nr, volatile unsigned long *addr, + bool value) +{ + if (value) + set_bit(nr, addr); + else + clear_bit(nr, addr); +} + +static __always_inline void __assign_bit(long nr, volatile unsigned long *addr, + bool value) +{ + if (value) + __set_bit(nr, addr); + else + __clear_bit(nr, addr); +} + #ifdef __KERNEL__ #ifndef set_mask_bits |