Skip to content

Commit

Permalink
regmap: Disable locking for RBTREE and MAPLE unit tests
Browse files Browse the repository at this point in the history
REGCACHE_RBTREE and REGCACHE_MAPLE dynamically allocate memory
for regmap operations. This is incompatible with spinlock based locking
which is used for fast_io operations. Disable locking for the associated
unit tests to avoid lockdep splashes.

Fixes: f033c26 ("regmap: Add maple tree based register cache")
Fixes: 2238959 ("regmap: Add some basic kunit tests")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230720032848.1306349-1-linux@roeck-us.net
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Guenter Roeck authored and Mark Brown committed Jul 20, 2023
1 parent b460a52 commit a9e2616
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/base/regmap/regmap-kunit.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ static struct regmap *gen_regmap(struct regmap_config *config,
int i;
struct reg_default *defaults;

config->disable_locking = config->cache_type == REGCACHE_RBTREE ||
config->cache_type == REGCACHE_MAPLE;

buf = kmalloc(size, GFP_KERNEL);
if (!buf)
return ERR_PTR(-ENOMEM);
Expand Down Expand Up @@ -889,6 +892,8 @@ static struct regmap *gen_raw_regmap(struct regmap_config *config,

config->cache_type = test_type->cache_type;
config->val_format_endian = test_type->val_endian;
config->disable_locking = config->cache_type == REGCACHE_RBTREE ||
config->cache_type == REGCACHE_MAPLE;

buf = kmalloc(size, GFP_KERNEL);
if (!buf)
Expand Down

0 comments on commit a9e2616

Please sign in to comment.