Skip to content

Commit

Permalink
pm: Fix possible undefined reference
Browse files Browse the repository at this point in the history
Function pm_state_cpu_get_all is declared in state.h
but it is only implemented if CONFIG_PM is set.

Add an inline implementation for when CONFIG_PM is not set.

Signed-off-by: Flavio Ceolin <[email protected]>
  • Loading branch information
Flavio Ceolin committed Oct 19, 2023
1 parent 0c3bb8d commit 0e1a6c5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/zephyr/pm/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ struct pm_state_info {
}


#if defined(CONFIG_PM) || defined(__DOXYGEN__)
/**
* Obtain information about all supported states by a CPU.
*
Expand All @@ -343,6 +344,18 @@ uint8_t pm_state_cpu_get_all(uint8_t cpu, const struct pm_state_info **states);
* @}
*/

#else /* CONFIG_PM */

static inline uint8_t pm_state_cpu_get_all(uint8_t cpu, const struct pm_state_info **states)
{
ARG_UNUSED(cpu);
ARG_UNUSED(states);

return 0;
}

#endif /* CONFIG_PM */

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 0e1a6c5

Please sign in to comment.