Skip to content

Commit e721792

Browse files
lyakhcarlescufi
authored andcommitted
ace: use a 'switch' statement in pm_state_set()
Use 'switch' to emphasise that we're handling different values of 'state' in pm_state_set(). Signed-off-by: Guennadi Liakhovetski <[email protected]>
1 parent c99a604 commit e721792

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

soc/xtensa/intel_adsp/ace/power.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ void pm_state_set(enum pm_state state, uint8_t substate_id)
243243
core_desc[cpu].intenable = XTENSA_RSR("INTENABLE");
244244
z_xt_ints_off(0xffffffff);
245245

246-
if (state == PM_STATE_SOFT_OFF) {
246+
switch (state) {
247+
case PM_STATE_SOFT_OFF:
247248
core_desc[cpu].bctl = DSPCS.bootctl[cpu].bctl;
248249
DSPCS.bootctl[cpu].bctl &= ~DSPBR_BCTL_WAITIPCG;
249250
if (cpu == 0) {
@@ -307,7 +308,8 @@ void pm_state_set(enum pm_state state, uint8_t substate_id)
307308
} else {
308309
power_gate_entry(cpu);
309310
}
310-
} else if (state == PM_STATE_RUNTIME_IDLE) {
311+
break;
312+
case PM_STATE_RUNTIME_IDLE:
311313
DSPCS.bootctl[cpu].bctl &= ~DSPBR_BCTL_WAITIPPG;
312314
DSPCS.bootctl[cpu].bctl &= ~DSPBR_BCTL_WAITIPCG;
313315
soc_cpu_power_down(cpu);
@@ -321,7 +323,8 @@ void pm_state_set(enum pm_state state, uint8_t substate_id)
321323
ret = pm_device_runtime_put(INTEL_ADSP_HST_DOMAIN_DEV);
322324
__ASSERT_NO_MSG(ret == 0);
323325
power_gate_entry(cpu);
324-
} else {
326+
break;
327+
default:
325328
__ASSERT(false, "invalid argument - unsupported power state");
326329
}
327330
}

0 commit comments

Comments
 (0)