Skip to content

Commit 7f843dd

Browse files
committed
intel_idle: Add __initdata annotations to init time variables
Annotate static variables cpuidle_state_table and mwait_substates with __initdata, because they are only used during the initialization of the driver. Also notice that static variable icpu could be annotated analogously and the structure pointed to by it could be __initconst, but two of its fields are accessed via icpu in intel_idle_cpu_init() and auto_demotion_disable(), so introduce two new static variables, auto_demotion_disable_flags and disable_promotion_to_c1e, to hold the values of these fields, set them during the initialization and use them in those functions instead of accessing the source data structure via icpu. That allows icpu to be annotated with __initdata, so do that, and it will also allow some __initconst annotations to be added subsequently. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 30a996f commit 7f843dd

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

drivers/idle/intel_idle.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ static struct cpuidle_driver intel_idle_driver = {
6565
static int max_cstate = CPUIDLE_STATE_MAX - 1;
6666
static unsigned int disabled_states_mask;
6767

68-
static unsigned int mwait_substates;
68+
static unsigned int mwait_substates __initdata;
69+
70+
static unsigned long auto_demotion_disable_flags;
71+
static bool disable_promotion_to_c1e;
72+
6973
static bool lapic_timer_always_reliable;
7074

7175
struct idle_cpu {
@@ -81,9 +85,9 @@ struct idle_cpu {
8185
bool use_acpi;
8286
};
8387

84-
static const struct idle_cpu *icpu;
88+
static const struct idle_cpu *icpu __initdata;
8589
static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
86-
static struct cpuidle_state *cpuidle_state_table;
90+
static struct cpuidle_state *cpuidle_state_table __initdata;
8791

8892
/*
8993
* Enable this state by default even if the ACPI _CST does not list it.
@@ -1519,7 +1523,7 @@ static void auto_demotion_disable(void)
15191523
unsigned long long msr_bits;
15201524

15211525
rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
1522-
msr_bits &= ~(icpu->auto_demotion_disable_flags);
1526+
msr_bits &= ~auto_demotion_disable_flags;
15231527
wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
15241528
}
15251529

@@ -1549,13 +1553,10 @@ static int intel_idle_cpu_init(unsigned int cpu)
15491553
return -EIO;
15501554
}
15511555

1552-
if (!icpu)
1553-
return 0;
1554-
1555-
if (icpu->auto_demotion_disable_flags)
1556+
if (auto_demotion_disable_flags)
15561557
auto_demotion_disable();
15571558

1558-
if (icpu->disable_promotion_to_c1e)
1559+
if (disable_promotion_to_c1e)
15591560
c1e_promotion_disable();
15601561

15611562
return 0;
@@ -1633,6 +1634,8 @@ static int __init intel_idle_init(void)
16331634
icpu = (const struct idle_cpu *)id->driver_data;
16341635
if (icpu) {
16351636
cpuidle_state_table = icpu->state_table;
1637+
auto_demotion_disable_flags = icpu->auto_demotion_disable_flags;
1638+
disable_promotion_to_c1e = icpu->disable_promotion_to_c1e;
16361639
if (icpu->use_acpi || force_use_acpi)
16371640
intel_idle_acpi_cst_extract();
16381641
} else if (!intel_idle_acpi_cst_extract()) {

0 commit comments

Comments
 (0)