Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 13/23] phy: freescale: Discard pm_runtime_put() return value
       [not found] <6245770.lOV4Wx5bFT@rafael.j.wysocki>
@ 2025-12-22 20:18 ` Rafael J. Wysocki
  2025-12-22 20:21 ` [PATCH v1 14/23] phy: rockchip-samsung-dcphy: " Rafael J. Wysocki
  2025-12-22 20:22 ` [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values Rafael J. Wysocki
  2 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2025-12-22 20:18 UTC (permalink / raw)
  To: Linux PM
  Cc: LKML, Ulf Hansson, Brian Norris, Vinod Koul, Neil Armstrong,
	Shawn Guo, Sascha Hauer, Fabio Estevam, linux-phy, imx

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Printing error messages on pm_runtime_put() returning negative values
is not particularly 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.

Accordingly, update mixel_lvds_phy_reset() to simply discard the return
value of pm_runtime_put().

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@intel.com>
---

This patch is part of a series, but it doesn't depend on anything else
in that series.  The last patch in the series depends on it.

It can be applied by itself and if you decide to do so, please let me
know.

Otherwise, an ACK or equivalent will be appreciated, but also the lack
of specific criticism will be eventually regarded as consent.

---
 drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c
+++ b/drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c
@@ -286,11 +286,9 @@ static int mixel_lvds_phy_reset(struct d
 
 	regmap_write(priv->regmap, PHY_CTRL, CTRL_RESET_VAL);
 
-	ret = pm_runtime_put(dev);
-	if (ret < 0)
-		dev_err(dev, "failed to put PM runtime: %d\n", ret);
+	pm_runtime_put(dev);
 
-	return ret;
+	return 0;
 }
 
 static struct phy *mixel_lvds_phy_xlate(struct device *dev,




-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 14/23] phy: rockchip-samsung-dcphy: Discard pm_runtime_put() return value
       [not found] <6245770.lOV4Wx5bFT@rafael.j.wysocki>
  2025-12-22 20:18 ` [PATCH v1 13/23] phy: freescale: Discard pm_runtime_put() return value Rafael J. Wysocki
@ 2025-12-22 20:21 ` Rafael J. Wysocki
  2025-12-22 20:22 ` [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values Rafael J. Wysocki
  2 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2025-12-22 20:21 UTC (permalink / raw)
  To: Linux PM
  Cc: LKML, Ulf Hansson, Brian Norris, Vinod Koul, Neil Armstrong,
	Heiko Stuebner, linux-phy, linux-rockchip

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Passing pm_runtime_put() return value to the callers is not particularly
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.  It also happens when the kernel is
configured with CONFIG_PM unset.

Accordingly, update samsung_mipi_dcphy_exit() to simply discard the
return value of pm_runtime_put() and always return success to the
caller.

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@intel.com>
---

This patch is part of a series, but it doesn't depend on anything else
in that series.  The last patch in the series depends on it.

It can be applied by itself and if you decide to do so, please let me
know.

Otherwise, an ACK or equivalent will be appreciated, but also the lack
of specific criticism will be eventually regarded as consent.

---
 drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
+++ b/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
@@ -1508,7 +1508,9 @@ static int samsung_mipi_dcphy_exit(struc
 {
 	struct samsung_mipi_dcphy *samsung = phy_get_drvdata(phy);
 
-	return pm_runtime_put(samsung->dev);
+	pm_runtime_put(samsung->dev);
+
+	return 0;
 }
 
 static const struct phy_ops samsung_mipi_dcphy_ops = {




-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values
       [not found] <6245770.lOV4Wx5bFT@rafael.j.wysocki>
  2025-12-22 20:18 ` [PATCH v1 13/23] phy: freescale: Discard pm_runtime_put() return value Rafael J. Wysocki
  2025-12-22 20:21 ` [PATCH v1 14/23] phy: rockchip-samsung-dcphy: " Rafael J. Wysocki
@ 2025-12-22 20:22 ` Rafael J. Wysocki
  2025-12-30 10:34   ` Geert Uytterhoeven
  2 siblings, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2025-12-22 20:22 UTC (permalink / raw)
  To: Linux PM
  Cc: LKML, Ulf Hansson, Brian Norris, Vinod Koul, Neil Armstrong,
	linux-phy

From: Rafael J. Wysocki <rafael.j.wysocki@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@intel.com>
---

This patch is part of a series, but it doesn't depend on anything else
in that series.  The last patch in the series depends on it.

It can be applied by itself and if you decide to do so, please let me
know.

Otherwise, an ACK or equivalent will be appreciated, but also the lack
of specific criticism will be eventually regarded as consent.

---
 drivers/phy/phy-core.c  |    9 +++------
 include/linux/phy/phy.h |    7 ++-----
 2 files changed, 5 insertions(+), 11 deletions(-)

--- 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;
-
-	return pm_runtime_put(&phy->dev);
+	pm_runtime_put(&phy->dev);
 }
 EXPORT_SYMBOL_GPL(phy_pm_runtime_put);
 
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -232,7 +232,7 @@ static inline void *phy_get_drvdata(stru
 #if IS_ENABLED(CONFIG_GENERIC_PHY)
 int phy_pm_runtime_get(struct phy *phy);
 int phy_pm_runtime_get_sync(struct phy *phy);
-int phy_pm_runtime_put(struct phy *phy);
+void phy_pm_runtime_put(struct phy *phy);
 int phy_pm_runtime_put_sync(struct phy *phy);
 int phy_init(struct phy *phy);
 int phy_exit(struct phy *phy);
@@ -312,11 +312,8 @@ static inline int phy_pm_runtime_get_syn
 	return -ENOSYS;
 }
 
-static inline int phy_pm_runtime_put(struct phy *phy)
+static inline void phy_pm_runtime_put(struct phy *phy)
 {
-	if (!phy)
-		return 0;
-	return -ENOSYS;
 }
 
 static inline int phy_pm_runtime_put_sync(struct phy *phy)




-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values
  2025-12-22 20:22 ` [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values Rafael J. Wysocki
@ 2025-12-30 10:34   ` Geert Uytterhoeven
  2025-12-30 10:54     ` Geert Uytterhoeven
  0 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2025-12-30 10:34 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PM, LKML, Ulf Hansson, Brian Norris, Vinod Koul,
	Neil Armstrong, linux-phy, Linux-Renesas

Hi Rafael,

On Mon, 22 Dec 2025 at 21:40, Rafael J. Wysocki <rafael@kernel.org> wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@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@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).

Reverting this commit fixes the issue.

> --- 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?
Thanks!

> -
> -       return pm_runtime_put(&phy->dev);
> +       pm_runtime_put(&phy->dev);
>  }
>  EXPORT_SYMBOL_GPL(phy_pm_runtime_put);
>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values
  2025-12-30 10:34   ` Geert Uytterhoeven
@ 2025-12-30 10:54     ` Geert Uytterhoeven
  2025-12-30 15:05       ` Geert Uytterhoeven
  2025-12-30 16:17       ` Rafael J. Wysocki
  0 siblings, 2 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2025-12-30 10:54 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PM, LKML, Ulf Hansson, Brian Norris, Vinod Koul,
	Neil Armstrong, linux-phy, Linux-Renesas

On Tue, 30 Dec 2025 at 11:34, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Mon, 22 Dec 2025 at 21:40, Rafael J. Wysocki <rafael@kernel.org> wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@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@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.

> Thanks!
>
> > -
> > -       return pm_runtime_put(&phy->dev);
> > +       pm_runtime_put(&phy->dev);
> >  }
> >  EXPORT_SYMBOL_GPL(phy_pm_runtime_put);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values
  2025-12-30 10:54     ` Geert Uytterhoeven
@ 2025-12-30 15:05       ` Geert Uytterhoeven
  2025-12-30 16:18         ` Rafael J. Wysocki
  2025-12-30 16:17       ` Rafael J. Wysocki
  1 sibling, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2025-12-30 15:05 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PM, LKML, Ulf Hansson, Brian Norris, Vinod Koul,
	Neil Armstrong, linux-phy, Linux-Renesas

On Tue, 30 Dec 2025 at 11:54, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Tue, 30 Dec 2025 at 11:34, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Mon, 22 Dec 2025 at 21:40, Rafael J. Wysocki <rafael@kernel.org> wrote:
> > > From: Rafael J. Wysocki <rafael.j.wysocki@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@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

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values
  2025-12-30 10:54     ` Geert Uytterhoeven
  2025-12-30 15:05       ` Geert Uytterhoeven
@ 2025-12-30 16:17       ` Rafael J. Wysocki
  1 sibling, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2025-12-30 16:17 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Linux PM, LKML, Ulf Hansson, Brian Norris,
	Vinod Koul, Neil Armstrong, linux-phy, Linux-Renesas

On Tue, Dec 30, 2025 at 11:54 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> On Tue, 30 Dec 2025 at 11:34, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Mon, 22 Dec 2025 at 21:40, Rafael J. Wysocki <rafael@kernel.org> wrote:
> > > From: Rafael J. Wysocki <rafael.j.wysocki@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@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?

Sorry for breaking this!

> I assume the PHY core should support both drivers that do and do not
> support Runtime PM.

Yes, it should be sufficient to restore the pm_runtime_enabled() check.

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values
  2025-12-30 15:05       ` Geert Uytterhoeven
@ 2025-12-30 16:18         ` Rafael J. Wysocki
  0 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2025-12-30 16:18 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Linux PM, LKML, Ulf Hansson, Brian Norris,
	Vinod Koul, Neil Armstrong, linux-phy, Linux-Renesas

On Tue, Dec 30, 2025 at 4:05 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> On Tue, 30 Dec 2025 at 11:54, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Tue, 30 Dec 2025 at 11:34, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > On Mon, 22 Dec 2025 at 21:40, Rafael J. Wysocki <rafael@kernel.org> wrote:
> > > > From: Rafael J. Wysocki <rafael.j.wysocki@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@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

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-12-30 16:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <6245770.lOV4Wx5bFT@rafael.j.wysocki>
2025-12-22 20:18 ` [PATCH v1 13/23] phy: freescale: Discard pm_runtime_put() return value Rafael J. Wysocki
2025-12-22 20:21 ` [PATCH v1 14/23] phy: rockchip-samsung-dcphy: " Rafael J. Wysocki
2025-12-22 20:22 ` [PATCH v1 15/23] phy: core: Discard pm_runtime_put() return values Rafael J. Wysocki
2025-12-30 10:34   ` Geert Uytterhoeven
2025-12-30 10:54     ` Geert Uytterhoeven
2025-12-30 15:05       ` Geert Uytterhoeven
2025-12-30 16:18         ` Rafael J. Wysocki
2025-12-30 16:17       ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox