Skip to content

Commit e12ff28

Browse files
minimaxwellbroonie
authored andcommitted
regmap: mmio: Allow passing an empty config->reg_stride
Regmap's stride is used for MMIO regmaps to check the correctness of reg_width. However, it's acceptable to pass an empty config->reg_stride, in that case the actual stride used is 1. There are valid cases now to pass an empty stride, when using down/upshifting of register address. In this case, the stride value loses its sense, so ignore the reg_width when the stride isn't set. Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com Link: https://lore.kernel.org/r/20230511142735.316445-1-maxime.chevallier@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org
1 parent f33a751 commit e12ff28

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/base/regmap/regmap-mmio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev,
448448
if (min_stride < 0)
449449
return ERR_PTR(min_stride);
450450

451-
if (config->reg_stride < min_stride)
451+
if (config->reg_stride && config->reg_stride < min_stride)
452452
return ERR_PTR(-EINVAL);
453453

454454
if (config->use_relaxed_mmio && config->io_port)

0 commit comments

Comments
 (0)