Skip to content

Commit 3290e9f

Browse files
committed
cpuidle: psci: Move the per CPU variable domain_state to a struct
To prepare to extend the per CPU variable domain_state to include more data, let's move it into a struct. A subsequent change will add the new data. This change have no intended functional impact. Signed-off-by: Ulf Hansson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9861f21 commit 3290e9f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

drivers/cpuidle/cpuidle-psci.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,28 @@ struct psci_cpuidle_data {
3636
struct device *dev;
3737
};
3838

39+
struct psci_cpuidle_domain_state {
40+
u32 state;
41+
};
42+
3943
static DEFINE_PER_CPU_READ_MOSTLY(struct psci_cpuidle_data, psci_cpuidle_data);
40-
static DEFINE_PER_CPU(u32, domain_state);
44+
static DEFINE_PER_CPU(struct psci_cpuidle_domain_state, psci_domain_state);
4145
static bool psci_cpuidle_use_syscore;
4246
static bool psci_cpuidle_use_cpuhp;
4347

4448
void psci_set_domain_state(u32 state)
4549
{
46-
__this_cpu_write(domain_state, state);
50+
__this_cpu_write(psci_domain_state.state, state);
4751
}
4852

4953
static inline u32 psci_get_domain_state(void)
5054
{
51-
return __this_cpu_read(domain_state);
55+
return __this_cpu_read(psci_domain_state.state);
56+
}
57+
58+
static inline void psci_clear_domain_state(void)
59+
{
60+
__this_cpu_write(psci_domain_state.state, 0);
5261
}
5362

5463
static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
@@ -87,7 +96,7 @@ static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
8796
cpu_pm_exit();
8897

8998
/* Clear the domain state to start fresh when back from idle. */
90-
psci_set_domain_state(0);
99+
psci_clear_domain_state();
91100
return ret;
92101
}
93102

@@ -121,7 +130,7 @@ static int psci_idle_cpuhp_down(unsigned int cpu)
121130
if (pd_dev) {
122131
pm_runtime_put_sync(pd_dev);
123132
/* Clear domain state to start fresh at next online. */
124-
psci_set_domain_state(0);
133+
psci_clear_domain_state();
125134
}
126135

127136
return 0;
@@ -147,7 +156,7 @@ static void psci_idle_syscore_switch(bool suspend)
147156

148157
/* Clear domain state to re-start fresh. */
149158
if (!cleared) {
150-
psci_set_domain_state(0);
159+
psci_clear_domain_state();
151160
cleared = true;
152161
}
153162
}

0 commit comments

Comments
 (0)