From: Nishanth Menon <nm@ti.com>
To: Lee Jones <lee@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, Mark Brown <broonie@kernel.org>,
Shawn Guo <shawnguo@kernel.org>, <linux-arm-msm@vger.kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
<bcm-kernel-feedback-list@broadcom.com>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
<linux-stm32@st-md-mailman.stormreply.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>
Subject: Re: [PATCH V2] mfd: syscon: Use regmap max_register_is_0 as needed
Date: Fri, 27 Sep 2024 07:00:21 -0500 [thread overview]
Message-ID: <20240927120021.b6okbwrdpguv4hp6@spiny> (raw)
In-Reply-To: <20240903184710.1552067-1-nm@ti.com>
On 13:47-20240903, Nishanth Menon wrote:
> 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>
> ---
>
> Based on my search
> https://gist.github.com/nmenon/d537096d041fa553565fba7577d2cd24, the
> pattern of syscon registers that may potentially be impacted by this
> patch (that are exactly 1 register wide) is probably limited, though
> this patch in itself was inspired by a buggy driver code fixed in
> https://lore.kernel.org/linux-pm/20240828131915.3198081-1-nm@ti.com/
> I have tried to Cc lists that may be interested in looking closer to
> avoid un-intended side-effects.
>
> Changes since V1:
> * Incorporate review comments by rewording commit message and $subject
> and dropped Fixes.
> * No functional change to the patch.
> * Expand the CC list to notify potential users.
>
> V1: https://lore.kernel.org/all/20240828121008.3066002-1-nm@ti.com/
>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: bcm-kernel-feedback-list@broadcom.com
> Cc: Florian Fainelli <florian.fainelli@broadcom.com>
> Cc: linux-stm32@st-md-mailman.stormreply.com
> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
A gentle ping.
>
> drivers/mfd/syscon.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> index 2ce15f60eb10..3e1d699ba934 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);
>
> --
> 2.46.0
>
>
--
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
next prev parent reply other threads:[~2024-09-27 12:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 18:47 [PATCH V2] mfd: syscon: Use regmap max_register_is_0 as needed Nishanth Menon
2024-09-27 12:00 ` Nishanth Menon [this message]
2024-09-30 14:43 ` (subset) " Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240927120021.b6okbwrdpguv4hp6@spiny \
--to=nm@ti.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andersson@kernel.org \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=broonie@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox