Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michael Walle and committed by
Mark Brown
a6d99022 9abf2313

+20
+13
drivers/base/regmap/regmap.c
··· 3486 3486 } 3487 3487 EXPORT_SYMBOL_GPL(regmap_get_reg_stride); 3488 3488 3489 + /** 3490 + * regmap_might_sleep() - Returns whether a regmap access might sleep. 3491 + * 3492 + * @map: Register map to operate on. 3493 + * 3494 + * Returns true if an access to the register might sleep, else false. 3495 + */ 3496 + bool regmap_might_sleep(struct regmap *map) 3497 + { 3498 + return map->can_sleep; 3499 + } 3500 + EXPORT_SYMBOL_GPL(regmap_might_sleep); 3501 + 3489 3502 int regmap_parse_val(struct regmap *map, const void *buf, 3490 3503 unsigned int *val) 3491 3504 {
+7
include/linux/regmap.h
··· 1219 1219 int regmap_get_val_bytes(struct regmap *map); 1220 1220 int regmap_get_max_register(struct regmap *map); 1221 1221 int regmap_get_reg_stride(struct regmap *map); 1222 + bool regmap_might_sleep(struct regmap *map); 1222 1223 int regmap_async_complete(struct regmap *map); 1223 1224 bool regmap_can_raw_write(struct regmap *map); 1224 1225 size_t regmap_get_raw_read_max(struct regmap *map); ··· 1904 1903 { 1905 1904 WARN_ONCE(1, "regmap API is disabled"); 1906 1905 return -EINVAL; 1906 + } 1907 + 1908 + static inline bool regmap_might_sleep(struct regmap *map) 1909 + { 1910 + WARN_ONCE(1, "regmap API is disabled"); 1911 + return true; 1907 1912 } 1908 1913 1909 1914 static inline int regcache_sync(struct regmap *map)