From: sashiko-bot@kernel.org
To: "Mohd Ayaan Anwar" <mohd.anwar@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH net-next v2 2/9] net: phy: dp83867: add regulator supply management
Date: Tue, 08 Sep 2026 20:25:12 +0000 [thread overview]
Message-ID: <20260908202513.0A4211F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260908-shikra_ethernet-v2-2-bbe3389d0652@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Incorrect usage of devm_regulator_get_enable_optional() causes unconditional 200ms boot delays.
- [Low] The `#ifdef CONFIG_OF` guard improperly restricts regulator management to device-tree platforms.
--
commit 6d9389913bb995393df4699729d85576835ff23d
Author: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
net: phy: dp83867: add regulator supply management
This commit adds regulator supply management during probe for the DP83867
PHY. It enables required power rails and sleeps 200ms if any supply was
enabled to meet datasheet requirements.
> diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
> index 88255e92b4cdb..dbeee7cad6f0c 100644
> --- a/drivers/net/phy/dp83867.c
> +++ b/drivers/net/phy/dp83867.c
[ ... ]
> @@ -719,9 +720,41 @@ static int dp83867_resume(struct phy_device *phydev)
> return 0;
> }
>
> +static int dp83867_power_on(struct phy_device *phydev)
> +{
> +#ifdef CONFIG_OF
[Severity: Low]
Does this restrict the regulator management to device tree platforms
unnecessarily?
The Linux regulator subsystem is firmware-agnostic and safely returns
-ENODEV when supplies are not found via standard mappings, so wrapping this
in an OF-specific guard appears to skip the initialization for platforms
using other configurations like ACPI or board files.
> + static const char * const supply_names[] = {
> + "vdda-2p5", "vdd-1p0", "vdda-1p8", "vddio",
> + };
> + struct device *dev = &phydev->mdio.dev;
> + u32 count = 0;
> + int i, ret;
> +
> + for (i = 0; i < ARRAY_SIZE(supply_names); i++) {
> + ret = devm_regulator_get_enable_optional(dev, supply_names[i]);
> + if (!ret)
> + count++;
[Severity: High]
Does this logic accurately detect newly-enabled regulators?
If CONFIG_REGULATOR is disabled, the dummy implementation of
devm_regulator_get_enable_optional() unconditionally returns 0, which would
falsely increment count to 4.
Furthermore, even if regulator support is enabled, it returns 0 for
regulators that are already enabled (e.g. shared supplies or boot-on
regulators). This contradicts the commit message's claim that it only sleeps
when a supply is "newly enabled".
Would it be better to open-code devm_regulator_get_optional() and check
regulator_is_enabled() before enabling the supply? That way the driver can
accurately detect if it was just turned on, avoiding an unconditional 200ms
boot delay per PHY.
> + else if (ret != -ENODEV)
> + return dev_err_probe(dev, ret,
> + "failed to enable %s supply\n",
> + supply_names[i]);
> + }
> +
> + /* Datasheet section 6.6 suggests a 200ms post power-up stabilization */
> + if (count)
> + fsleep(200000);
> +#endif
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260908-shikra_ethernet-v2-0-bbe3389d0652@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-09-08 20:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 20:23 [PATCH net-next v2 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-09-07 20:23 ` [PATCH net-next v2 1/9] dt-bindings: net: ti,dp83867: add supply properties Mohd Ayaan Anwar
2026-09-11 11:25 ` netdev-bot+sashiko
2026-09-07 20:23 ` [PATCH net-next v2 2/9] net: phy: dp83867: add regulator supply management Mohd Ayaan Anwar
2026-09-08 15:01 ` Andrew Davis
2026-09-08 20:25 ` sashiko-bot [this message]
2026-09-09 17:08 ` Lorenzo Bianconi
2026-09-11 11:25 ` netdev-bot+sashiko
2026-09-07 20:23 ` [PATCH net-next v2 3/9] dt-bindings: net: qcom,ethqos: add qcom,shikra-ethqos compatible Mohd Ayaan Anwar
2026-09-08 20:25 ` sashiko-bot
2026-09-11 11:25 ` netdev-bot+sashiko
2026-09-07 20:23 ` [PATCH net-next v2 4/9] net: stmmac: qcom-ethqos: convert ethqos_rgmii_macro_init() to void Mohd Ayaan Anwar
2026-09-09 17:16 ` Lorenzo Bianconi
2026-09-11 11:25 ` netdev-bot+sashiko
2026-09-07 20:23 ` [PATCH net-next v2 5/9] net: stmmac: qcom-ethqos: fix RGMII_ID mode to use DLL bypass Mohd Ayaan Anwar
2026-09-08 20:25 ` sashiko-bot
2026-09-11 11:25 ` netdev-bot+sashiko
2026-09-07 20:23 ` [PATCH net-next v2 6/9] net: stmmac: qcom-ethqos: warn about legacy RGMII PHY modes Mohd Ayaan Anwar
2026-09-11 11:25 ` netdev-bot+sashiko
2026-09-07 20:23 ` [PATCH net-next v2 7/9] net: stmmac: qcom-ethqos: set initial RGMII link clock to lowest speed Mohd Ayaan Anwar
2026-09-08 20:25 ` sashiko-bot
2026-09-11 11:25 ` netdev-bot+sashiko
2026-09-07 20:23 ` [PATCH net-next v2 8/9] net: stmmac: qcom-ethqos: add per-platform NOC clock voting Mohd Ayaan Anwar
2026-09-09 18:47 ` Lorenzo Bianconi
2026-09-11 11:25 ` netdev-bot+sashiko
2026-09-07 20:23 ` [PATCH net-next v2 9/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-09-09 18:55 ` Lorenzo Bianconi
2026-09-11 11:25 ` netdev-bot+sashiko
2026-09-11 14:26 ` Konrad Dybcio
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=20260908202513.0A4211F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=mohd.anwar@oss.qualcomm.com \
--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;
as well as URLs for NNTP newsgroup(s).