Skip to content

Commit 7826c06

Browse files
fenrus75rafaeljw
authored andcommitted
intel_idle: clean up the (new) state_update_enter_method function
Now that the logic for state_update_enter_method() is in its own function, the long if .. else if .. else if .. else if chain can be simplified by just returning from the function at the various places. This does not change functionality, but it makes the logic much simpler to read or modify later. Signed-off-by: Arjan van de Ven <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 4622ba9 commit 7826c06

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

drivers/idle/intel_idle.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,17 +1849,26 @@ static void state_update_enter_method(struct cpuidle_state *state, int cstate)
18491849
WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IBRS);
18501850
WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
18511851
state->enter = intel_idle_xstate;
1852-
} else if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) &&
1852+
return;
1853+
}
1854+
1855+
if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) &&
18531856
state->flags & CPUIDLE_FLAG_IBRS) {
18541857
/*
18551858
* IBRS mitigation requires that C-states are entered
18561859
* with interrupts disabled.
18571860
*/
18581861
WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
18591862
state->enter = intel_idle_ibrs;
1860-
} else if (state->flags & CPUIDLE_FLAG_IRQ_ENABLE) {
1863+
return;
1864+
}
1865+
1866+
if (state->flags & CPUIDLE_FLAG_IRQ_ENABLE) {
18611867
state->enter = intel_idle_irq;
1862-
} else if (force_irq_on) {
1868+
return;
1869+
}
1870+
1871+
if (force_irq_on) {
18631872
pr_info("forced intel_idle_irq for state %d\n", cstate);
18641873
state->enter = intel_idle_irq;
18651874
}

0 commit comments

Comments
 (0)