Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

watchdog: rti_wdt: Drop runtime pm reference count when watchdog is unused

Call runtime_pm_put*() if watchdog is not already started during probe and re
enable it in watchdog start as required.

On K3 SoCs, watchdogs and their corresponding CPUs are under same
power-domain, so if the reference count of unused watchdogs aren't
dropped, it will lead to CPU hotplug failures as Device Management
firmware won't allow to turn off the power-domain due to dangling
reference count.

Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support")
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Tested-by: Manorit Chawdhry <m-chawdhry@ti.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20231213140110.938129-1-vigneshr@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Vignesh Raghavendra and committed by
Wim Van Sebroeck
c1a6edf3 f7799988

+12 -1
+12 -1
drivers/watchdog/rti_wdt.c
··· 77 77 { 78 78 u32 timer_margin; 79 79 struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd); 80 + int ret; 81 + 82 + ret = pm_runtime_resume_and_get(wdd->parent); 83 + if (ret) 84 + return ret; 80 85 81 86 /* set timeout period */ 82 87 timer_margin = (u64)wdd->timeout * wdt->freq; ··· 348 343 if (last_ping) 349 344 watchdog_set_last_hw_keepalive(wdd, last_ping); 350 345 346 + if (!watchdog_hw_running(wdd)) 347 + pm_runtime_put_sync(&pdev->dev); 348 + 351 349 return 0; 352 350 353 351 err_iomap: ··· 365 357 struct rti_wdt_device *wdt = platform_get_drvdata(pdev); 366 358 367 359 watchdog_unregister_device(&wdt->wdd); 368 - pm_runtime_put(&pdev->dev); 360 + 361 + if (!pm_runtime_suspended(&pdev->dev)) 362 + pm_runtime_put(&pdev->dev); 363 + 369 364 pm_runtime_disable(&pdev->dev); 370 365 } 371 366