Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 5/7] regulator: lp872x: Remove platform_data based probing
Date: Tue, 13 Oct 2026 18:27:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-170326@kernel.org> (raw)
In-Reply-To: <20261013181417.492252-6-clamor95@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] gpio: gpiod_set_value() called with enum gpiod_flags instead of logical integer
--

commit 66e7cc15bc21448dbaf8906353d687e2f61e221f
Author: Svyatoslav Ryhel <clamor95@gmail.com>

regulator: lp872x: Remove platform_data based probing

The platform_data-based probing is tightly integrated into the lp872x
driver structure itself; removing just the platform data support is
impossible without remodeling major parts of the probe sequence.
The lp872x_platform_data structure was removed, and its contents were
incorporated into the driver private structure and lp872x_chip_info.

> diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
> index 1e16d7e8361a0..50870ffe75ac5 100644
> --- a/drivers/regulator/lp872x.c
> +++ b/drivers/regulator/lp872x.c
[ ... ]
> @@ -344,10 +333,9 @@ static int lp872x_buck_set_voltage_sel(struct regulator_dev *rdev,
>  	struct lp872x *lp = rdev_get_drvdata(rdev);
>  	enum lp872x_regulator_id buck = rdev_get_id(rdev);
>  	u32 addr, mask = LP872X_VOUT_M;
> -	struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs : NULL;
>  
> -	if (dvs && dvs->gpio)
> -		lp872x_set_dvs(lp, dvs->vsel, dvs->gpio);
> +	if (lp->dvs_gpio)
> +		lp872x_set_dvs(lp, lp->vsel, lp->dvs_gpio);
>  
>  	addr = lp872x_select_buck_vout_addr(lp, buck);
>  	if (!lp872x_is_valid_buck_addr(addr))

[Severity: High]
This problem wasn't introduced by this patch, but the modification of the caller
in lp872x_buck_set_voltage_sel() retains a broken data path under the new driver
structure.

Does lp872x_set_dvs() incorrectly pass enum gpiod_flags to gpiod_set_value()?

Looking at lp872x_set_dvs(), it assigns enum values to state:

	state = dvs_sel == SEL_V1 ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
	gpiod_set_value(gpio, state);

Because both GPIOD_OUT_HIGH and GPIOD_OUT_LOW evaluate to non-zero values,
gpiod_set_value() will always drive the GPIO high, breaking the dynamic voltage
scaling (DVS) state selection.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013181417.492252-1-clamor95@gmail.com?part=5

  reply	other threads:[~2026-10-13 18:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 18:14 [PATCH v2 0/7] lp872x: remove platform_data based probing and adjustments Svyatoslav Ryhel
2026-10-13 18:14 ` [PATCH v2 1/7] regulator: dt-bindings: ti,lp872x: Deprecate ti,dvs-gpio and ti,update-config Svyatoslav Ryhel
2026-10-13 18:22   ` sashiko-bot
2026-10-13 18:14 ` [PATCH v2 2/7] regulator: dt-bindings: ti,lp872x: Document input supplies Svyatoslav Ryhel
2026-10-13 18:14 ` [PATCH v2 3/7] regulator: lp872x: Fold driver header into driver file Svyatoslav Ryhel
2026-10-13 18:14 ` [PATCH v2 4/7] regulator: lp872x: Remove redundant regmap wrappers Svyatoslav Ryhel
2026-10-13 18:14 ` [PATCH v2 5/7] regulator: lp872x: Remove platform_data based probing Svyatoslav Ryhel
2026-10-13 18:27   ` sashiko-bot [this message]
2026-10-13 18:14 ` [PATCH v2 6/7] regulator: lp872x: Add support for input and regulator power supplies Svyatoslav Ryhel
2026-10-13 18:14 ` [PATCH v2 7/7] regulator: lp872x: Use macro to fill regulator descriptor Svyatoslav Ryhel

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=sashiko-outbox-170326@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --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