Skip to content

prompts: handle Runtime PM conditional gets - #422

Open
OllieinCanada wants to merge 1 commit into
sashiko-dev:mainfrom
OllieinCanada:fix/396-runtime-pm-prompt
Open

prompts: handle Runtime PM conditional gets#422
OllieinCanada wants to merge 1 commit into
sashiko-dev:mainfrom
OllieinCanada:fix/396-runtime-pm-prompt

Conversation

@OllieinCanada

@OllieinCanada OllieinCanada commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #396

Summary

Teach Sashiko's power-management prompt to account for the configuration-dependent return contract of pm_runtime_get_if_active() and pm_runtime_get_if_in_use().

Root cause

With CONFIG_PM=n, these helpers return a negative stub value while Runtime PM put operations are no-ops. Treating every negative return as an error that requires an early return can incorrectly suppress hardware operations in kernels built without Runtime PM.

Changes

  • distinguish positive, zero, and negative conditional-get results
  • require proof from the exact helper, configuration, and device lifecycle
  • preserve reference-balance warnings when Runtime PM may be disabled for a device under CONFIG_PM=y
  • avoid applying this exception to helpers with different contracts
  • correct the existing IRQ example so it does not recommend ret <= 0 unconditionally

Validation

  • verified the behavior against the upstream Linux Runtime PM header and implementation
  • cargo fmt --all -- --check
  • git diff --check
  • exact one-file cumulative diff
  • signed-off commit verified
  • GitHub Actions DCO, lint, and Rust unit-test jobs pass

@rgushchin

Copy link
Copy Markdown
Member

LGTM, but it's in a draft state, should I move on and merge it? Or there is something to wait for?

@OllieinCanada
OllieinCanada marked this pull request as ready for review August 12, 2026 19:35
@OllieinCanada

Copy link
Copy Markdown
Contributor Author

Thanks! Nothing else is pending from my side. I have marked the PR ready for review; please feel free to merge it.

@rgushchin

Copy link
Copy Markdown
Member

Cool, thanks!
Can you, please, fix the SOB line with the real name and email?
Thanks

Signed-off-by: Oliver Slapinski <olliefromcanada@gmail.com>
@OllieinCanada
OllieinCanada force-pushed the fix/396-runtime-pm-prompt branch from a10a6ab to 2b2b856 Compare August 14, 2026 18:12
@OllieinCanada

Copy link
Copy Markdown
Contributor Author

Updated the commit with my real author and Signed-off-by identity. DCO, lint, and unit tests are all green, and nothing else is pending from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive around Runtime PM get()/put()

2 participants