From: netdev-bot+sashiko@kernel.org
To: wanghr2026@mail.zgclab.edu.cn
Cc: chester.a.unal@arinc9.com, daniel@makrotopia.org, andrew@lunn.ch,
olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com,
angelogioacchino.delregno@collabora.com, netdev@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/5] net: dsa: mt7530: disable regulators on switch teardown
Date: Fri, 04 Dec 2026 07:51:01 +0000 [thread overview]
Message-ID: <179637066109.3146.17558378695130953570@kernel.org> (raw)
In-Reply-To: <179628050300.1224.2498848542937309110@mail.zgclab.edu.cn>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] mt753x_teardown() (drivers/net/dsa/mt7530.c) now turns off the
MT7530 core and io regulators (regulator_disable(priv->core_pwr) /…
--
net: dsa: mt7530: disable regulators on switch teardown
This moves the MT7530 core and io regulator disable from mt7530_remove()
to mt753x_teardown(), after the stats polling work is cancelled. The aim
is to turn off the regulators of a switch that is torn down because a
sibling in a multi-switch tree failed setup.
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index d5a199293f78a..c2f12ae2c6d7b 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -3237,9 +3237,22 @@ static void
> mt753x_teardown(struct dsa_switch *ds)
> {
> struct mt7530_priv *priv = ds->priv;
> + int ret;
>
> if (priv->bus)
> cancel_delayed_work_sync(&priv->stats_work);
> +
> + if (priv->id == ID_MT7530) {
> + ret = regulator_disable(priv->core_pwr);
> + if (ret < 0)
> + dev_err(priv->dev,
> + "Failed to disable core power: %d\n", ret);
> +
> + ret = regulator_disable(priv->io_pwr);
> + if (ret < 0)
> + dev_err(priv->dev, "Failed to disable io pwr: %d\n",
> + ret);
> + }
> }
[Severity: Low]
Is it safe to cut power here while resources registered by mt753x_setup()
are still live?
stats_work is the only thing stopped before the regulators go off. The
regmap IRQ chip, the internal MDIO bus and the GPIO controller are all
devm-managed. They are only released when the driver unbinds:
mt7530_setup_irq():
ret = devm_regmap_add_irq_chip_fwnode(dev, dev_fwnode(dev),
priv->regmap, irq, ...
mt7530_setup_mdio():
ret = devm_of_mdiobus_register(dev, bus, mnp);
mt7530_setup_gpio():
return devm_gpiochip_add_data(dev, gc, priv);
The commit message describes a case where a sibling switch fails setup and
the tree is torn down:
dsa_tree_setup()
dsa_tree_teardown_switches()
dsa_switch_teardown()
ds->ops->teardown()
mt753x_teardown()
Here the MT7530 probe has already returned 0, so mt7530_remove() never
runs. The device stays bound and the chip has no power, but the parent IRQ
handler, the MDIO bus (mt753x_phy_read_c22() and related accessors) and
the GPIO chip are all still registered. Before this patch the rails stayed
on in this state.
mt7530_setup_irq() sets TOP_SIG_CTRL_NORMAL so the chip drives its INT
pin. If that line floats or reads as asserted after power is removed,
regmap_irq_thread() would read and ack MT7530_SYS_INT_STS over MDIO on an
unpowered device. The nested PHY IRQs were already freed during port
teardown. Could this keep returning IRQ_NONE until the IRQ core reports
"nobody cared" and disables the line?
Anything still using the GPIO chip (for example gpio-leds on the switch
LED pins) would also read garbage or have its writes lost.
The commit message gives this reason for the ordering:
"after the stats polling work is cancelled so that no poll can run
against an unpowered switch"
That covers stats_work, but not the IRQ thread, the MDIO bus or the GPIO
chip. Setup powers the chip on and then registers these. Teardown powers
it off while they are still registered.
A later patch in the series, "net: dsa: mt7530: register the GPIO
controller last in setup", says the GPIO controller must not stay
registered across a powered-off failed setup. The same state seems to
exist after teardown here.
The final patch in the series, "net: dsa: mt7530: disable regulators on
mt753x_setup() failure", moves the disable into sw_teardown() but keeps
the same order. So this seems to still be present at the end of the
series.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179628050300.1224.11499384961750115678%40mail.zgclab.edu.cn
next prev parent reply other threads:[~2026-12-04 7:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 6:48 [PATCH net-next v2 0/5] net: dsa: mt7530: disable regulators on teardown and setup failure Haoran Wang
2026-12-03 6:48 ` [PATCH net-next v2 2/5] net: dsa: mt7530: factor out mt7530_disable_pwrs() Haoran Wang
2026-12-03 6:48 ` [PATCH net-next v2 5/5] net: dsa: mt7530: disable regulators on mt753x_setup() failure Haoran Wang
2026-12-04 7:51 ` netdev-bot+sashiko
2026-12-03 6:48 ` [PATCH net-next v2 4/5] net: dsa: mt7530: disable regulators on setup failure Haoran Wang
2026-12-03 6:48 ` [PATCH net-next v2 3/5] net: dsa: mt7530: register the GPIO controller last in setup Haoran Wang
2026-12-04 7:51 ` netdev-bot+sashiko
2026-12-03 6:48 ` [PATCH net-next v2 1/5] net: dsa: mt7530: disable regulators on switch teardown Haoran Wang
2026-12-04 7:51 ` netdev-bot+sashiko [this message]
2026-12-03 6:53 ` [PATCH net-next v2 0/5] net: dsa: mt7530: disable regulators on teardown and setup failure netdev-bot+sinfo
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=179637066109.3146.17558378695130953570@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chester.a.unal@arinc9.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=wanghr2026@mail.zgclab.edu.cn \
/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