pm: Change pm_power_state_next_get to support SMP
Change the API to account multiple CPUs.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
diff --git a/include/pm/pm.h b/include/pm/pm.h
index f59af42..b98bc61 100644
--- a/include/pm/pm.h
+++ b/include/pm/pm.h
@@ -178,9 +178,10 @@
* This function returns the next power state that will be used by the
* SoC.
*
+ * @param cpu CPU index.
* @return next pm_state_info that will be used
*/
-const struct pm_state_info pm_power_state_next_get(void);
+const struct pm_state_info pm_power_state_next_get(uint8_t cpu);
/**
* @brief Do any SoC or architecture specific post ops after sleep state exits.
@@ -209,7 +210,7 @@
#define pm_power_state_set(info)
#define pm_power_state_exit_post_ops(info)
-#define pm_power_state_next_get() \
+#define pm_power_state_next_get(cpu) \
((struct pm_state_info){PM_STATE_ACTIVE, 0, 0})
#endif /* CONFIG_PM */
diff --git a/subsys/pm/power.c b/subsys/pm/power.c
index cb9fbf9..53f7807 100644
--- a/subsys/pm/power.c
+++ b/subsys/pm/power.c
@@ -365,7 +365,7 @@
return ret;
}
-const struct pm_state_info pm_power_state_next_get(void)
+const struct pm_state_info pm_power_state_next_get(uint8_t cpu)
{
- return z_power_states[_current_cpu->id];
+ return z_power_states[cpu];
}