[PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values

Rafael J. Wysocki rafael at kernel.org
Tue Dec 30 08:18:38 PST 2025


On Tue, Dec 30, 2025 at 4:05 PM Geert Uytterhoeven <geert at linux-m68k.org> wrote:
>
> On Tue, 30 Dec 2025 at 11:54, Geert Uytterhoeven <geert at linux-m68k.org> wrote:
> > On Tue, 30 Dec 2025 at 11:34, Geert Uytterhoeven <geert at linux-m68k.org> wrote:
> > > On Mon, 22 Dec 2025 at 21:40, Rafael J. Wysocki <rafael at kernel.org> wrote:
> > > > From: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
> > > >
> > > > The PHY core defines phy_pm_runtime_put() to return an int, but that
> > > > return value is never used.  It also passes the return value of
> > > > pm_runtime_put() to the caller which is not very useful.
> > > >
> > > > Returning an error code from pm_runtime_put() merely means that it has
> > > > not queued up a work item to check whether or not the device can be
> > > > suspended and there are many perfectly valid situations in which that
> > > > can happen, like after writing "on" to the devices' runtime PM "control"
> > > > attribute in sysfs for one example.
> > > >
> > > > Modify phy_pm_runtime_put() to discard the pm_runtime_put() return
> > > > value and change its return type to void.  Also drop the redundant
> > > > pm_runtime_enabled() call from there.
> > > >
> > > > No intentional functional impact.
> > > >
> > > > This will facilitate a planned change of the pm_runtime_put() return
> > > > type to void in the future.
> > > >
> > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
> > >
> > > Thanks for your patch, which is now commit caad07ae07e3fb17 ("phy:
> > > core: Discard pm_runtime_put() return values") in phy/next.
> > >
> > > This is causing several messages like
> > >
> > >     phy phy-e6590100.usb-phy-controller.2: Runtime PM usage count underflow!
> > >
> > > during boot, and s2ram on Koelsch (R-Car M2-W).
> >
> > On R-Car Gen3, there are no such messages, as e.g.
> > drivers/phy/renesas/phy-rcar-gen3-usb2.c does support Runtime PM.
> > R-Car Gen2 uses drivers/phy/renesas/phy-rcar-gen2.c, which does not
> > use Runtime PM yet, but still relies on explicit clock management.
> >
> > > > --- a/drivers/phy/phy-core.c
> > > > +++ b/drivers/phy/phy-core.c
> > > > @@ -190,15 +190,12 @@ int phy_pm_runtime_get_sync(struct phy *
> > > >  }
> > > >  EXPORT_SYMBOL_GPL(phy_pm_runtime_get_sync);
> > > >
> > > > -int phy_pm_runtime_put(struct phy *phy)
> > > > +void phy_pm_runtime_put(struct phy *phy)
> > > >  {
> > > >         if (!phy)
> > > > -               return 0;
> > > > +               return;
> > > >
> > > > -       if (!pm_runtime_enabled(&phy->dev))
> > > > -               return -ENOTSUPP;
> > >
> > > Adding some instrumentation shows that this branch was taken before,
> > > thus skipping the call to pm_runtime_put().
> > >
> > > Can I just put the check back, or is there an underlying problem that
> > > should be fixed instead?
> >
> > I assume the PHY core should support both drivers that do and do not
> > support Runtime PM.
>
> I have sent a patch:
> https://lore.kernel.org/3ca9f8166d21685bfbf97535da30172f74822130.1767107014.git.geert+renesas@glider.be

LGTM



More information about the linux-phy mailing list