summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2022-01-18 09:28:21 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2022-01-18 09:28:24 +0100
commita3787cd1bb0b290de44c8e947db742057c71011b (patch)
treec747bc80a7eee6b615c3b9f432af7faa79308cff /include
parent9129a0ecf96880c95a211c6c7ede94690f6cb494 (diff)
downloadbarebox-a3787cd1bb0b290de44c8e947db742057c71011b.tar.gz
barebox-a3787cd1bb0b290de44c8e947db742057c71011b.tar.xz
regmap: Implement regmap_[set|clear]_bits()
regmap_[set|clear]_bits() are useful shortcuts to regmap_update_bits(). Implement them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/regmap.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/regmap.h b/include/regmap.h
index db84c7a534..4b30c21776 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -130,6 +130,18 @@ int regmap_write_bits(struct regmap *map, unsigned int reg,
int regmap_update_bits(struct regmap *map, unsigned int reg,
unsigned int mask, unsigned int val);
+static inline int regmap_set_bits(struct regmap *map,
+ unsigned int reg, unsigned int bits)
+{
+ return regmap_update_bits(map, reg, bits, bits);
+}
+
+static inline int regmap_clear_bits(struct regmap *map,
+ unsigned int reg, unsigned int bits)
+{
+ return regmap_update_bits(map, reg, bits, 0);
+}
+
/**
* regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs
*