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

Configure Feed

Select the types of activity you want to include in your feed.

mfd: syscon: Use regmap max_register_is_0 as needed

syscon has always set the optional max_register configuration of
regmap to ensure the correct checks are in place. However, a recent
commit 0ec74ad3c157 ("regmap: rework ->max_register handling")
introduced explicit configuration in regmap framework for register
maps that is exactly 1 register, when max_register is pointing to a
valid register 0. This commit solved a previous limitation of regmap
framework.

Update syscon driver to consistent in regmap configuration for
all sizes of syscons by using this new capability by setting
max_register_is_0, when the max_register is valid and 0.

Signed-off-by: Nishanth Menon <nm@ti.com>
Link: https://lore.kernel.org/r/20240903184710.1552067-1-nm@ti.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Nishanth Menon and committed by
Lee Jones
2e63d6fa 98b5f770

+5
+5
drivers/mfd/syscon.c
··· 108 108 syscon_config.reg_stride = reg_io_width; 109 109 syscon_config.val_bits = reg_io_width * 8; 110 110 syscon_config.max_register = resource_size(&res) - reg_io_width; 111 + if (!syscon_config.max_register) 112 + syscon_config.max_register_is_0 = true; 111 113 112 114 regmap = regmap_init_mmio(NULL, base, &syscon_config); 113 115 kfree(syscon_config.name); ··· 359 357 return -ENOMEM; 360 358 361 359 syscon_config.max_register = resource_size(res) - 4; 360 + if (!syscon_config.max_register) 361 + syscon_config.max_register_is_0 = true; 362 + 362 363 if (pdata) 363 364 syscon_config.name = pdata->label; 364 365 syscon->regmap = devm_regmap_init_mmio(dev, base, &syscon_config);