summaryrefslogtreecommitdiff
path: root/drivers/idle
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2023-04-19 17:39:43 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-04-27 20:37:36 +0300
commit1abffbd827668b3b44c34b168ccb5ee2866714a8 (patch)
treefba10dcc45ac7e165b5684fab3148e90775eaed9 /drivers/idle
parenta78032e94bf16e9c53238cd83c82095b4a251d4b (diff)
downloadlinux-1abffbd827668b3b44c34b168ccb5ee2866714a8.tar.xz
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: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Reviewed-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/idle')
-rw-r--r--drivers/idle/intel_idle.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 190410fc9ce5..73ddb1d8cfcf 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1871,6 +1871,7 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
}
for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) {
+ struct cpuidle_state *state;
unsigned int mwait_hint;
if (intel_idle_max_cstate_reached(cstate))
@@ -1893,29 +1894,30 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
/* Structure copy. */
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);
- drv->states[drv->state_count].enter = intel_idle_irq;
+ state->enter = intel_idle_irq;
}
if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) &&
- drv->states[drv->state_count].flags & CPUIDLE_FLAG_IBRS) {
- WARN_ON_ONCE(drv->states[drv->state_count].flags & CPUIDLE_FLAG_IRQ_ENABLE);
- drv->states[drv->state_count].enter = intel_idle_ibrs;
+ state->flags & CPUIDLE_FLAG_IBRS) {
+ WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
+ state->enter = intel_idle_ibrs;
}
- if (drv->states[drv->state_count].flags & CPUIDLE_FLAG_INIT_XSTATE)
- drv->states[drv->state_count].enter = intel_idle_xstate;
+ if (state->flags & CPUIDLE_FLAG_INIT_XSTATE)
+ state->enter = intel_idle_xstate;
if ((disabled_states_mask & BIT(drv->state_count)) ||
((icpu->use_acpi || force_use_acpi) &&
intel_idle_off_by_default(mwait_hint) &&
- !(drv->states[drv->state_count].flags & CPUIDLE_FLAG_ALWAYS_ENABLE)))
- drv->states[drv->state_count].flags |= CPUIDLE_FLAG_OFF;
+ !(state->flags & CPUIDLE_FLAG_ALWAYS_ENABLE)))
+ state->flags |= CPUIDLE_FLAG_OFF;
- if (intel_idle_state_needs_timer_stop(&drv->states[drv->state_count]))
- drv->states[drv->state_count].flags |= CPUIDLE_FLAG_TIMER_STOP;
+ if (intel_idle_state_needs_timer_stop(state))
+ state->flags |= CPUIDLE_FLAG_TIMER_STOP;
drv->state_count++;
}