Commit 1abffbd8 authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by Rafael J. Wysocki

intel_idle: further intel_idle_init_cstates_icpu() cleanup

Introduce a temporary 'state' variable for referencing the currently
processed C-state in the intel_idle_init_cstates_icpu() function.

This makes code lines shorter and easier to read.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent a78032e9
...@@ -1871,6 +1871,7 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv) ...@@ -1871,6 +1871,7 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
} }
for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) { for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) {
struct cpuidle_state *state;
unsigned int mwait_hint; unsigned int mwait_hint;
if (intel_idle_max_cstate_reached(cstate)) if (intel_idle_max_cstate_reached(cstate))
...@@ -1893,29 +1894,30 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv) ...@@ -1893,29 +1894,30 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
/* Structure copy. */ /* Structure copy. */
drv->states[drv->state_count] = cpuidle_state_table[cstate]; drv->states[drv->state_count] = cpuidle_state_table[cstate];
state = &drv->states[drv->state_count];
if ((drv->states[drv->state_count].flags & CPUIDLE_FLAG_IRQ_ENABLE) || force_irq_on) { if ((state->flags & CPUIDLE_FLAG_IRQ_ENABLE) || force_irq_on) {
pr_info("forced intel_idle_irq for state %d\n", cstate); pr_info("forced intel_idle_irq for state %d\n", cstate);
drv->states[drv->state_count].enter = intel_idle_irq; state->enter = intel_idle_irq;
} }
if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) && if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) &&
drv->states[drv->state_count].flags & CPUIDLE_FLAG_IBRS) { state->flags & CPUIDLE_FLAG_IBRS) {
WARN_ON_ONCE(drv->states[drv->state_count].flags & CPUIDLE_FLAG_IRQ_ENABLE); WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
drv->states[drv->state_count].enter = intel_idle_ibrs; state->enter = intel_idle_ibrs;
} }
if (drv->states[drv->state_count].flags & CPUIDLE_FLAG_INIT_XSTATE) if (state->flags & CPUIDLE_FLAG_INIT_XSTATE)
drv->states[drv->state_count].enter = intel_idle_xstate; state->enter = intel_idle_xstate;
if ((disabled_states_mask & BIT(drv->state_count)) || if ((disabled_states_mask & BIT(drv->state_count)) ||
((icpu->use_acpi || force_use_acpi) && ((icpu->use_acpi || force_use_acpi) &&
intel_idle_off_by_default(mwait_hint) && intel_idle_off_by_default(mwait_hint) &&
!(drv->states[drv->state_count].flags & CPUIDLE_FLAG_ALWAYS_ENABLE))) !(state->flags & CPUIDLE_FLAG_ALWAYS_ENABLE)))
drv->states[drv->state_count].flags |= CPUIDLE_FLAG_OFF; state->flags |= CPUIDLE_FLAG_OFF;
if (intel_idle_state_needs_timer_stop(&drv->states[drv->state_count])) if (intel_idle_state_needs_timer_stop(state))
drv->states[drv->state_count].flags |= CPUIDLE_FLAG_TIMER_STOP; state->flags |= CPUIDLE_FLAG_TIMER_STOP;
drv->state_count++; drv->state_count++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment