Skip to content

Commit dab2017

Browse files
committed
intel_idle: Eliminate redundant static variable
The value of the lapic_timer_always_reliable static variable in the intel_idle driver reflects the boot_cpu_has(X86_FEATURE_ARAT) value and so it also reflects the static_cpu_has(X86_FEATURE_ARAT) value. Hence, the lapic_timer_always_reliable check in intel_idle() is redundant and apart from this lapic_timer_always_reliable is only used in two places in which boot_cpu_has(X86_FEATURE_ARAT) can be used directly. Eliminate the lapic_timer_always_reliable variable in accordance with the above observations. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 9ebcfad commit dab2017

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/idle/intel_idle.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
6666
static unsigned long auto_demotion_disable_flags;
6767
static bool disable_promotion_to_c1e;
6868

69-
static bool lapic_timer_always_reliable;
70-
7169
struct idle_cpu {
7270
struct cpuidle_state *state_table;
7371

@@ -142,7 +140,7 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
142140
if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
143141
leave_mm(cpu);
144142

145-
if (!static_cpu_has(X86_FEATURE_ARAT) && !lapic_timer_always_reliable) {
143+
if (!static_cpu_has(X86_FEATURE_ARAT)) {
146144
/*
147145
* Switch over to one-shot tick broadcast if the target C-state
148146
* is deeper than C1.
@@ -1562,7 +1560,7 @@ static int intel_idle_cpu_online(unsigned int cpu)
15621560
{
15631561
struct cpuidle_device *dev;
15641562

1565-
if (!lapic_timer_always_reliable)
1563+
if (!boot_cpu_has(X86_FEATURE_ARAT))
15661564
tick_broadcast_enable();
15671565

15681566
/*
@@ -1655,16 +1653,13 @@ static int __init intel_idle_init(void)
16551653
goto init_driver_fail;
16561654
}
16571655

1658-
if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
1659-
lapic_timer_always_reliable = true;
1660-
16611656
retval = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "idle/intel:online",
16621657
intel_idle_cpu_online, NULL);
16631658
if (retval < 0)
16641659
goto hp_setup_fail;
16651660

16661661
pr_debug("Local APIC timer is reliable in %s\n",
1667-
lapic_timer_always_reliable ? "all C-states" : "C1");
1662+
boot_cpu_has(X86_FEATURE_ARAT) ? "all C-states" : "C1");
16681663

16691664
return 0;
16701665

0 commit comments

Comments
 (0)