@@ -33,6 +33,7 @@ struct dtpm_cpu {
};
static DEFINE_PER_CPU(struct dtpm_cpu *, dtpm_per_cpu);
+static int cpuhp_dtpm_cpu_online_state;
static struct dtpm_cpu *to_dtpm_cpu(struct dtpm *dtpm)
{
@@ -296,12 +297,16 @@ static int dtpm_cpu_init(void)
if (ret < 0)
return ret;
+ cpuhp_dtpm_cpu_online_state = ret;
return 0;
}
static void dtpm_cpu_exit(void)
{
- cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN);
+ if (cpuhp_dtpm_cpu_online_state > 0) {
+ cpuhp_remove_state_nocalls(cpuhp_dtpm_cpu_online_state);
+ cpuhp_dtpm_cpu_online_state = 0;
+ }
cpuhp_remove_state_nocalls(CPUHP_AP_DTPM_CPU_DEAD);
}
Requesting a CPUHP_AP_ONLINE_DYN cpuhp state reserves a state among the range [CPUHP_AP_ONLINE_DYN:CPUHP_AP_ONLINE_DYN_END]. The reserved state must be saved in order to remove it later. Cf. __cpuhp_setup_state_cpuslocked() documentation: Return: On success: Positive state number if @state is CPUHP_AP_ONLINE_DYN; 0 for all other states Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> --- drivers/powercap/dtpm_cpu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)