Linux I2C development
 help / color / mirror / Atom feed
* [PATCH] i2c: xiic: restore runtime PM teardown in remove to fix clk WARN flood
@ 2026-08-13 21:06 Abdurrahman Hussain
  2026-08-14  9:30 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Abdurrahman Hussain @ 2026-08-13 21:06 UTC (permalink / raw)
  To: Michal Simek, Andi Shyti, Andy Shevchenko
  Cc: linux-arm-kernel, linux-i2c, linux-kernel, Abdurrahman Hussain

The devres conversion dropped the remove-time runtime PM trailer
(pm_runtime_disable + pm_runtime_set_suspended +
pm_runtime_dont_use_autosuspend). devm_pm_runtime_enable's release
action then calls pm_runtime_dont_use_autosuspend() while runtime PM
is still enabled, triggering an immediate runtime suspend: the suspend
callback clk_disable()s the clock that the devm_clk_get_enabled()
release is about to clk_disable_unprepare(), and every device teardown
WARNs in clk_core_disable() ("clkN already disabled").

Restore the trailer: with runtime PM disabled and the state forced to
suspended before devres runs, the suspend callback cannot fire and the
clock enable count stays balanced.

Fixes: 50c63491ff26 ("i2c: xiic: switch to devres managed APIs")
---
Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
---
 drivers/i2c/busses/i2c-xiic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 3e7735e1dae0..89636ca36915 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -1545,6 +1545,9 @@ static void xiic_i2c_remove(struct platform_device *pdev)
 		xiic_deinit(i2c);
 
 	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
+	pm_runtime_set_suspended(dev);
+	pm_runtime_dont_use_autosuspend(dev);
 }
 
 static const struct dev_pm_ops xiic_dev_pm_ops = {

---
base-commit: d58772d8520c7ef247c4b95c9bd76d3a25da9ff5
change-id: 20260813-i2c-xiic-restore-runtime-pm-teardown-dd0ab1db2c02

Best regards,
--  
Abdurrahman Hussain <abdurrahman@nexthop.ai>


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

* Re: [PATCH] i2c: xiic: restore runtime PM teardown in remove to fix clk WARN flood
  2026-08-13 21:06 [PATCH] i2c: xiic: restore runtime PM teardown in remove to fix clk WARN flood Abdurrahman Hussain
@ 2026-08-14  9:30 ` Andy Shevchenko
  2026-08-14 17:57   ` Abdurrahman Hussain
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2026-08-14  9:30 UTC (permalink / raw)
  To: Abdurrahman Hussain
  Cc: Michal Simek, Andi Shyti, linux-arm-kernel, linux-i2c,
	linux-kernel

On Thu, Aug 13, 2026 at 02:06:40PM -0700, Abdurrahman Hussain wrote:
> The devres conversion dropped the remove-time runtime PM trailer
> (pm_runtime_disable + pm_runtime_set_suspended +
> pm_runtime_dont_use_autosuspend). devm_pm_runtime_enable's release
> action then calls pm_runtime_dont_use_autosuspend() while runtime PM
> is still enabled, triggering an immediate runtime suspend: the suspend
> callback clk_disable()s the clock that the devm_clk_get_enabled()
> release is about to clk_disable_unprepare(), and every device teardown
> WARNs in clk_core_disable() ("clkN already disabled").
> 
> Restore the trailer: with runtime PM disabled and the state forced to
> suspended before devres runs, the suspend callback cannot fire and the
> clock enable count stays balanced.
> 
> Fixes: 50c63491ff26 ("i2c: xiic: switch to devres managed APIs")
> ---

^^^ Something went wrong. The SoB must be part of the official commit message.
Putting it under the cutter '---' line makes it disappear.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] i2c: xiic: restore runtime PM teardown in remove to fix clk WARN flood
  2026-08-14  9:30 ` Andy Shevchenko
@ 2026-08-14 17:57   ` Abdurrahman Hussain
  0 siblings, 0 replies; 3+ messages in thread
From: Abdurrahman Hussain @ 2026-08-14 17:57 UTC (permalink / raw)
  To: Andy Shevchenko, Abdurrahman Hussain
  Cc: Michal Simek, Andi Shyti, linux-arm-kernel, linux-i2c,
	linux-kernel

On Fri Aug 14, 2026 at 2:30 AM PDT, Andy Shevchenko wrote:
> On Thu, Aug 13, 2026 at 02:06:40PM -0700, Abdurrahman Hussain wrote:
>> The devres conversion dropped the remove-time runtime PM trailer
>> (pm_runtime_disable + pm_runtime_set_suspended +
>> pm_runtime_dont_use_autosuspend). devm_pm_runtime_enable's release
>> action then calls pm_runtime_dont_use_autosuspend() while runtime PM
>> is still enabled, triggering an immediate runtime suspend: the suspend
>> callback clk_disable()s the clock that the devm_clk_get_enabled()
>> release is about to clk_disable_unprepare(), and every device teardown
>> WARNs in clk_core_disable() ("clkN already disabled").
>> 
>> Restore the trailer: with runtime PM disabled and the state forced to
>> suspended before devres runs, the suspend callback cannot fire and the
>> clock enable count stays balanced.
>> 
>> Fixes: 50c63491ff26 ("i2c: xiic: switch to devres managed APIs")
>> ---
>
> ^^^ Something went wrong. The SoB must be part of the official commit message.
> Putting it under the cutter '---' line makes it disappear.

My bad,

Let me fix it and send v2

Thanks,
Abdurrahman

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

end of thread, other threads:[~2026-08-14 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13 21:06 [PATCH] i2c: xiic: restore runtime PM teardown in remove to fix clk WARN flood Abdurrahman Hussain
2026-08-14  9:30 ` Andy Shevchenko
2026-08-14 17:57   ` Abdurrahman Hussain

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