Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: joy.zou@oss.nxp.com
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH 2/2] regulator: pf0900: Modify volatile register range definition
Date: Thu, 18 Jun 2026 02:06:57 +0000	[thread overview]
Message-ID: <20260618020657.F0BA81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260618-b4-regulator-opt-v1-2-c43b1f62aaf6@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The `.n_yes_ranges` field in `pf0900_volatile_regs` is hardcoded to 1, causing most volatile registers to be ignored.
- [High] Interrupt status registers (_INT) are omitted from the volatile ranges, breaking IRQ handling.
--

commit 8da34e61f8f6ebeaacd20e2bb532c2786ad28d72
Author: Joy Zou <joy.zou@nxp.com>

regulator: pf0900: Modify volatile register range definition
    
The pf0900_range was incorrectly defined as a single continuous range
from PF0900_REG_DEV_ID to PF0900_REG_SYS_DIAG. This commit ensures only
volatile registers are read from the device on each access, while other
registers can be cached by regmap.

> diff --git a/drivers/regulator/pf0900-regulator.c b/drivers/regulator/pf0900-regulator.c
> index 5c44d2dbcab4d..bca76c58ed3bf 100644
> --- a/drivers/regulator/pf0900-regulator.c
> +++ b/drivers/regulator/pf0900-regulator.c
> @@ -284,13 +284,24 @@ struct pf0900_regulator_irq {
>  	unsigned int  event;
>  };
>  
> -static const struct regmap_range pf0900_range = {
> -	.range_min = PF0900_REG_DEV_ID,
> -	.range_max = PF0900_REG_SYS_DIAG,
> +static const struct regmap_range pf0900_range[] = {
> +	regmap_reg_range(PF0900_REG_SYSTEM_INT, PF0900_REG_SYSTEM_INT),
> +	regmap_reg_range(PF0900_REG_STATUS1_SNS, PF0900_REG_STATUS1_SNS),

[Severity: High]
Does this new configuration omit the interrupt status registers needed by
pf0900_irq_handler()?

Looking at pf0900_irq_handler(), it relies on regmap_read() to query the
hardware interrupt status:

pf0900_irq_handler() {
	...
	ret = regmap_read(pf0900->regmap, regu_irqs[i].reg, &val);
	...
}

Since these _INT registers are no longer listed in the volatile ranges,
will regmap reads return cached values instead of the actual hardware
state, causing the driver to silently ignore active interrupts?

[ ... ]

> +	regmap_reg_range(PF0900_REG_SECURE_WR1, PF0900_REG_SECURE_WR1),
> +	regmap_reg_range(PF0900_REG_WD_CNT1, PF0900_REG_WD_CNT2),
> +	regmap_reg_range(PF0900_REG_SYS_DIAG, PF0900_REG_SYS_DIAG),
>  };
>  
>  static const struct regmap_access_table pf0900_volatile_regs = {
> -	.yes_ranges = &pf0900_range,
> +	.yes_ranges = pf0900_range,
>  	.n_yes_ranges = 1,

[Severity: High]
Should this be updated to ARRAY_SIZE(pf0900_range)?

With n_yes_ranges hardcoded to 1, won't the regmap subsystem ignore all
but the very first entry (PF0900_REG_SYSTEM_INT) in the array? This
could cause reads to the remaining hardware status registers to return
stale cached values.

>  };

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260618-b4-regulator-opt-v1-0-c43b1f62aaf6@oss.nxp.com?part=2

  reply	other threads:[~2026-06-18  2:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18  2:03 [PATCH 0/2] regulator code improvements joy.zou
2026-06-18  2:03 ` [PATCH 1/2] regulator: pca9450: Correct default t_off_deb for PCA9451A/PCA9452 joy.zou
2026-06-18  3:07   ` Frank Li
2026-06-18  2:03 ` [PATCH 2/2] regulator: pf0900: Modify volatile register range definition joy.zou
2026-06-18  2:06   ` sashiko-bot [this message]
2026-06-18  6:54   ` Francesco Dolcini

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=20260618020657.F0BA81F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=joy.zou@oss.nxp.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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