zephyr: pm_runtime: use the correct type for CPU power state count#10860
Open
abonislawski wants to merge 1 commit into
Open
zephyr: pm_runtime: use the correct type for CPU power state count#10860abonislawski wants to merge 1 commit into
abonislawski wants to merge 1 commit into
Conversation
pm_state_cpu_get_all() returns uint8_t, so num_cpu_states must be uint8_t too. The explicit (int) cast on the loop init is only cosmetics, matching the Zephyr reference pm policy. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the custom Zephyr PM policy implementation to use the correct width for the CPU power state count, aligning num_cpu_states with the return type of pm_state_cpu_get_all() and ensuring the reverse-iteration loop remains well-defined.
Changes:
- Change
num_cpu_statesfromunsigned inttouint8_tinpm_policy_next_state(). - Add an explicit cast in the loop initializer to ensure the reverse loop start value is computed as a signed integer.
tmleman
approved these changes
Jun 9, 2026
tmleman
left a comment
Contributor
There was a problem hiding this comment.
I was about to write that CONFIG_PM_POLICY_CUSTOM is not used anywhere but I checked and it turns out it is. On ACE we switched to the default version long ago. When creating NVL, the old version was copied and updates probably didn't include them. This will need to be fixed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pm_state_cpu_get_all() returns uint8_t, so num_cpu_states must be uint8_t too.
The explicit (int) cast on the loop init is only cosmetics, matching the Zephyr reference pm policy.