watchdog: starfive: runtime PM cleanup
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest6 patches 2 repliesIn review
- v26 patches 0 repliesSuperseded
Changes in v3 from the cover letter
- 2/6 (pm_runtime_put_sync positive return): the v2 commit message and code comment described the semantics of a "1" return as "the device is still in use", which is wrong — that case is signalled by -EAGAIN. A positive return indicates a non-error condition such as the device already being in the requested state. Reword both the commit message and the in-function comment to describe this correctly. No code change beyond that.
- 3/6 (probe error path restructure): the v2 patch left a path that put the runtime PM usage counter twice. When the success-path pm_runtime_put_sync() (line ~513) returns an error, the function jumps to err_unregister_wdt. In v2 that label fell through to err_put_pm, which called pm_runtime_put_sync() a second time on a counter that had already been decremented by the first put. Insert an explicit "goto err_pm_disable;" after the unregister so the post-register error path skips the second put.
- 4/6 (system suspend/resume guard): the v2 patch added a pm_runtime_status_suspended() check on the resume path but kept the final restart predicate as watchdog_active(). For watchdogs started via early_enable, the framework state is WDOG_HW_RUNNING without WDOG_ACTIVE, so the existing predicate left the hardware permanently stopped after a system suspend/resume cycle (the matching suspend path had already stopped it). Extend the predicate to also accept watchdog_hw_running().
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | watchdog: starfive: balance PM refcount when start operation failsdrivers/ | +6 | 1 reply | |
| 2/6 | watchdog: starfive: treat pm_runtime_put_sync() positive return as successdrivers/ | +10 | 0 replies | |
| 3/6 | watchdog: starfive: balance PM refcount and disable in probe error pathsdrivers/ | +20 | 0 replies | |
| 4/6 | watchdog: starfive: guard system suspend/resume hardware accessdrivers/ | +27 | 0 replies | |
| 5/6 | watchdog: starfive: avoid PM refcount underflow in shutdowndrivers/ | +13 | 0 replies | |
| 6/6 | watchdog: starfive: release early_enable PM refcount on removedrivers/ | +13 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH v3 0/6] watchdog: starfive: runtime PM cleanup
This series addresses runtime PM correctness issues in the StarFive watchdog driver. v3 fixes three issues that were raised against v2:
Changes in v3:
- 2/6 (pm_runtime_put_sync positive return): the v2 commit message and code comment described the semantics of a "1" return as "the device is still in use", which is wrong — that case is signalled by -EAGAIN. A positive return indicates a non-error condition such as the device already being in the requested state. Reword both the commit message and the in-function comment to describe this correctly. No code change beyond that.
- 3/6 (probe error path restructure): the v2 patch left a path that put the runtime PM usage counter twice. When the success-path pm_runtime_put_sync() (line ~513) returns an error, the function jumps to err_unregister_wdt. In v2 that label fell through to err_put_pm, which called pm_runtime_put_sync() a second time on a counter that had already been decremented by the first put. Insert an explicit "goto err_pm_disable;" after the unregister so the post-register error path skips the second put.
- 4/6 (system suspend/resume guard): the v2 patch added a pm_runtime_status_suspended() check on the resume path but kept the final restart predicate as watchdog_active(). For watchdogs started via early_enable, the framework state is WDOG_HW_RUNNING without WDOG_ACTIVE, so the existing predicate left the hardware permanently stopped after a system suspend/resume cycle (the matching suspend path had already stopped it). Extend the predicate to also accept watchdog_hw_running().
Patches 1, 5, and 6 are unchanged from v2.
Several pre-existing issues in adjacent code paths were flagged during v2 review (hardware access during driver unbind, possible races between device_shutdown() and the watchdog reboot notifier, SETTIMEOUT/GETTIMELEFT ioctls touching gated registers). They are not addressed in this series; each is a separate logical change that deserves its own patch and its own justification. Happy to follow up on any the maintainers want addressed first.
The whole series builds cleanly with CONFIG_STARFIVE_WATCHDOG=m on x86_64 defconfig. Runtime testing would require StarFive JH7100 / JH7110 hardware and has not been performed.
William Theesfeld (6):
watchdog: starfive: balance PM refcount when start operation fails
watchdog: starfive: treat pm_runtime_put_sync() positive return as
success
watchdog: starfive: balance PM refcount and disable in probe error
paths
watchdog: starfive: guard system suspend/resume hardware access
watchdog: starfive: avoid PM refcount underflow in shutdown
watchdog: starfive: release early_enable PM refcount on remove
drivers/watchdog/starfive-wdt.c | 109 ++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 20 deletions(-)
Signature · 1 line
2.54.0