Re: [PATCH 2/3] net: stmmac: restore pinctrl when driver remove.
From: Linus Walleij
Date: Thu Feb 19 2026 - 17:21:05 EST
On Thu, Feb 19, 2026 at 8:25 PM Russell King (Oracle)
<linux@xxxxxxxxxxxxxxx> wrote:
> On Thu, Feb 19, 2026 at 08:11:13PM +0100, Linus Walleij wrote:
> > There is really no other cleanup that can happen: there is no
> > before-default-or-init state we can revert to (that would be the
> > power-on values), so there are just these states in some pointers
> > that could be accessed by e.g. pinctrl_pm_select_sleep_state()
> > that get free:ed up, and muxing and pin config that happened
> > in the pin control hardware just stays around.
>
> What we seem to end up with is that on probe failure, we set the pins
> to init or default state.
Indeed.
> However, on remove, it's up to the driver to
> decide whether to put the pins into sleep state or not.
>
> Shouldn't a driver be consistent, and place the pins into the same
> state in both these scenarios?
I think you're right. Just very few device trees define the "sleep"
state (the infamous "so far so good...") so it has not been adressed.
> Conversely, I'm slightly worried that putting pins into sleep state
> when we're not powering down may be bad if they're allowed to then
> float, which could cause the PHY to interfere on the network.
That's a good point.
It's perfectly legal to define any random state for the driver, such
as "relaxed" or "unused". It had the only downside that the device
driver core will not help out in looking up the state by default.
I'd be happy to take a patch that e.g. looks for an "unused"
state and put the pins into that state if probe fails, or when
remove() is called, so we get something everyone can use for
this.
Yours,
Linus Walleij