summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2022-11-21 16:08:42 +0100
committerMark Brown <broonie@kernel.org>2022-11-22 13:23:17 +0100
commita6d99022e56e8c1ddc4c75895ed9e3ce5da88453 (patch)
tree7537b99e86ac937a24f11d3d0b65a405bfa488e3 /drivers/base
parentLinux 6.1-rc1 (diff)
downloadlinux-a6d99022e56e8c1ddc4c75895ed9e3ce5da88453.tar.xz
linux-a6d99022e56e8c1ddc4c75895ed9e3ce5da88453.zip
regmap: add regmap_might_sleep()
With the dawn of MMIO gpio-regmap users, it is desirable to let gpio-regmap ask the regmap if it might sleep during an access so it can pass that information to gpiochip. Add a new regmap_might_sleep() to query the regmap. Signed-off-by: Michael Walle <michael@walle.cc> Link: https://lore.kernel.org/r/20221121150843.1562603-1-michael@walle.cc Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c6d6d53e8cd3..d12d669157f2 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -3486,6 +3486,19 @@ int regmap_get_reg_stride(struct regmap *map)
}
EXPORT_SYMBOL_GPL(regmap_get_reg_stride);
+/**
+ * regmap_might_sleep() - Returns whether a regmap access might sleep.
+ *
+ * @map: Register map to operate on.
+ *
+ * Returns true if an access to the register might sleep, else false.
+ */
+bool regmap_might_sleep(struct regmap *map)
+{
+ return map->can_sleep;
+}
+EXPORT_SYMBOL_GPL(regmap_might_sleep);
+
int regmap_parse_val(struct regmap *map, const void *buf,
unsigned int *val)
{