Skip to content

Commit 5615e46

Browse files
keith-zephyrkartben
authored andcommitted
pm: Cleanup PM stats
Convert PM stats code to use IS_ENABLED in place of #ifdefs. Signed-off-by: Keith Short <keithshort@google.com>
1 parent 22ca514 commit 5615e46

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

subsys/pm/pm.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,22 @@ bool pm_system_suspend(int32_t kernel_ticks)
209209
* sent the notification in pm_system_resume().
210210
*/
211211
k_sched_lock();
212-
pm_stats_start();
212+
213+
if (IS_ENABLED(CONFIG_PM_STATS)) {
214+
pm_stats_start();
215+
}
213216
/* Enter power state */
214217
pm_state_notify(true);
215218
atomic_set_bit(z_post_ops_required, id);
216219
pm_state_set(z_cpus_pm_state[id]->state, z_cpus_pm_state[id]->substate_id);
217-
pm_stats_stop();
218220

219221
/* Wake up sequence starts here */
220-
pm_stats_update(z_cpus_pm_state[id]->state);
222+
223+
if (IS_ENABLED(CONFIG_PM_STATS)) {
224+
pm_stats_stop();
225+
pm_stats_update(z_cpus_pm_state[id]->state);
226+
}
227+
221228
pm_system_resume();
222229
k_sched_unlock();
223230
SYS_PORT_TRACING_FUNC_EXIT(pm, system_suspend, ticks,

subsys/pm/pm_stats.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010

1111
#include <zephyr/pm/state.h>
1212

13-
#ifdef CONFIG_PM_STATS
1413
void pm_stats_start(void);
1514
void pm_stats_stop(void);
1615
void pm_stats_update(enum pm_state state);
17-
#else
18-
static inline void pm_stats_start(void) {}
19-
static inline void pm_stats_stop(void) {}
20-
static inline void pm_stats_update(enum pm_state state) {}
21-
#endif /* CONFIG_PM_STATS */
2216

2317
#endif /* ZEPHYR_SUBSYS_PM_PM_STATS_H_ */

0 commit comments

Comments
 (0)