aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bitops.h
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2017-11-09 09:38:42 +0100
committerLinus Walleij <linus.walleij@linaro.org>2017-11-09 09:38:42 +0100
commitbee67c7c9d7d3252dce69c960a53e53fd6b04e09 (patch)
treee01f03a5c4530936c734508ec75ca82b37b484b8 /include/linux/bitops.h
parentpinctrl: gemini: Fix GMAC groups (diff)
parentpinctrl: bcm2835: Fix some merge fallout (diff)
downloadlinux-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.h24
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