Skip to content

zephyr: pm_runtime: use the correct type for CPU power state count#10860

Open
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/pm-policy-type
Open

zephyr: pm_runtime: use the correct type for CPU power state count#10860
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/pm-policy-type

Conversation

@abonislawski

Copy link
Copy Markdown
Member

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.

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>
Copilot AI review requested due to automatic review settings June 9, 2026 11:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_states from unsigned int to uint8_t in pm_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 tmleman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

3 participants