mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] phy: core: Reinstate pm_runtime_enabled() check in phy_pm_runtime_put()
@ 2025-12-30 15:04 Geert Uytterhoeven
  2025-12-30 17:10 ` Wysocki, Rafael J
  2026-01-01 11:08 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2025-12-30 15:04 UTC (permalink / raw)
  To: Vinod Koul, Neil Armstrong, Rafael J . Wysocki
  Cc: linux-phy, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

On Koelsch (R-Car M2-W), during boot and s2ram:

    phy phy-e6590100.usb-phy-controller.0: Runtime PM usage count underflow!

While phy_pm_runtime_get{,_sync}() and phy_pm_runtime_put_sync() still
contain pm_runtime_enabled() checks, the same check in
phy_pm_runtime_put() was deemed redundant and removed, causing count
underflows with PHY drivers like drivers/phy/renesas/phy-rcar-gen2.c
that do not use Runtime PM yet,

Fix this by reinstating the check.

Fixes: caad07ae07e3fb17 ("phy: core: Discard pm_runtime_put() return values")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/phy/phy-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 160ecb757d1d62a0..e2a2a99d069789c7 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -195,6 +195,9 @@ void phy_pm_runtime_put(struct phy *phy)
 	if (!phy)
 		return;
 
+	if (!pm_runtime_enabled(&phy->dev))
+		return;
+
 	pm_runtime_put(&phy->dev);
 }
 EXPORT_SYMBOL_GPL(phy_pm_runtime_put);
-- 
2.43.0


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

* Re: [PATCH] phy: core: Reinstate pm_runtime_enabled() check in phy_pm_runtime_put()
  2025-12-30 15:04 [PATCH] phy: core: Reinstate pm_runtime_enabled() check in phy_pm_runtime_put() Geert Uytterhoeven
@ 2025-12-30 17:10 ` Wysocki, Rafael J
  2026-01-01 11:08 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Wysocki, Rafael J @ 2025-12-30 17:10 UTC (permalink / raw)
  To: Geert Uytterhoeven, Vinod Koul, Neil Armstrong
  Cc: linux-phy, linux-renesas-soc, linux-kernel


On 12/30/2025 4:04 PM, Geert Uytterhoeven wrote:
> On Koelsch (R-Car M2-W), during boot and s2ram:
>
>      phy phy-e6590100.usb-phy-controller.0: Runtime PM usage count underflow!
>
> While phy_pm_runtime_get{,_sync}() and phy_pm_runtime_put_sync() still
> contain pm_runtime_enabled() checks, the same check in
> phy_pm_runtime_put() was deemed redundant and removed, causing count
> underflows with PHY drivers like drivers/phy/renesas/phy-rcar-gen2.c
> that do not use Runtime PM yet,
>
> Fix this by reinstating the check.
>
> Fixes: caad07ae07e3fb17 ("phy: core: Discard pm_runtime_put() return values")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


> ---
>   drivers/phy/phy-core.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 160ecb757d1d62a0..e2a2a99d069789c7 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -195,6 +195,9 @@ void phy_pm_runtime_put(struct phy *phy)
>   	if (!phy)
>   		return;
>   
> +	if (!pm_runtime_enabled(&phy->dev))
> +		return;
> +
>   	pm_runtime_put(&phy->dev);
>   }
>   EXPORT_SYMBOL_GPL(phy_pm_runtime_put);

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

* Re: [PATCH] phy: core: Reinstate pm_runtime_enabled() check in phy_pm_runtime_put()
  2025-12-30 15:04 [PATCH] phy: core: Reinstate pm_runtime_enabled() check in phy_pm_runtime_put() Geert Uytterhoeven
  2025-12-30 17:10 ` Wysocki, Rafael J
@ 2026-01-01 11:08 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2026-01-01 11:08 UTC (permalink / raw)
  To: Neil Armstrong, Rafael J . Wysocki, Geert Uytterhoeven
  Cc: linux-phy, linux-renesas-soc, linux-kernel


On Tue, 30 Dec 2025 16:04:05 +0100, Geert Uytterhoeven wrote:
> On Koelsch (R-Car M2-W), during boot and s2ram:
> 
>     phy phy-e6590100.usb-phy-controller.0: Runtime PM usage count underflow!
> 
> While phy_pm_runtime_get{,_sync}() and phy_pm_runtime_put_sync() still
> contain pm_runtime_enabled() checks, the same check in
> phy_pm_runtime_put() was deemed redundant and removed, causing count
> underflows with PHY drivers like drivers/phy/renesas/phy-rcar-gen2.c
> that do not use Runtime PM yet,
> 
> [...]

Applied, thanks!

[1/1] phy: core: Reinstate pm_runtime_enabled() check in phy_pm_runtime_put()
      commit: 0287c960b15f27498d85cadf584bb59301ea2382

Best regards,
-- 
~Vinod



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

end of thread, other threads:[~2026-01-01 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-30 15:04 [PATCH] phy: core: Reinstate pm_runtime_enabled() check in phy_pm_runtime_put() Geert Uytterhoeven
2025-12-30 17:10 ` Wysocki, Rafael J
2026-01-01 11:08 ` Vinod Koul

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

all inboxes | Powered by JetHome®