diff options
author | Maxime Chevallier <maxime.chevallier@bootlin.com> | 2023-05-11 16:27:35 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-05-12 10:28:19 +0900 |
commit | e12ff28764937dd58c8613f16065da60da149048 (patch) | |
tree | 534e895b1b7c33a4ced39325972ec349af68a1c7 /drivers/base | |
parent | f33a751d5a7fe03b11d95e6a33e1fdd3b4f8ec18 (diff) | |
download | linux-e12ff28764937dd58c8613f16065da60da149048.tar.gz linux-e12ff28764937dd58c8613f16065da60da149048.tar.bz2 linux-e12ff28764937dd58c8613f16065da60da149048.zip |
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
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/regmap-mmio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index 3ccdd86a97e7..8132b5c101c4 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c @@ -448,7 +448,7 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, if (min_stride < 0) return ERR_PTR(min_stride); - if (config->reg_stride < min_stride) + if (config->reg_stride && config->reg_stride < min_stride) return ERR_PTR(-EINVAL); if (config->use_relaxed_mmio && config->io_port) |