From: Nishanth Menon Date: Tue, 3 Sep 2024 18:47:10 +0000 (-0500) Subject: mfd: syscon: Use regmap max_register_is_0 as needed X-Git-Tag: v6.13-rc1~113^2~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e63d6fa113d36238052321d21806a9f8495862a;p=thirdparty%2Flinux.git 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 Link: https://lore.kernel.org/r/20240903184710.1552067-1-nm@ti.com Signed-off-by: Lee Jones --- diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index 2ce15f60eb107..3e1d699ba9340 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -108,6 +108,8 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) syscon_config.reg_stride = reg_io_width; syscon_config.val_bits = reg_io_width * 8; syscon_config.max_register = resource_size(&res) - reg_io_width; + if (!syscon_config.max_register) + syscon_config.max_register_is_0 = true; regmap = regmap_init_mmio(NULL, base, &syscon_config); kfree(syscon_config.name); @@ -357,6 +359,9 @@ static int syscon_probe(struct platform_device *pdev) return -ENOMEM; syscon_config.max_register = resource_size(res) - 4; + if (!syscon_config.max_register) + syscon_config.max_register_is_0 = true; + if (pdata) syscon_config.name = pdata->label; syscon->regmap = devm_regmap_init_mmio(dev, base, &syscon_config);