--- zzzz-none-000/linux-3.10.107/drivers/cpuidle/governors/ladder.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/cpuidle/governors/ladder.c 2021-02-04 17:41:59.000000000 +0000 @@ -66,7 +66,7 @@ static int ladder_select_state(struct cpuidle_driver *drv, struct cpuidle_device *dev) { - struct ladder_device *ldev = &__get_cpu_var(ladder_devices); + struct ladder_device *ldev = this_cpu_ptr(&ladder_devices); struct ladder_device_state *last_state; int last_residency, last_idx = ldev->last_state_idx; int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); @@ -79,12 +79,7 @@ last_state = &ldev->states[last_idx]; - if (drv->states[last_idx].flags & CPUIDLE_FLAG_TIME_VALID) { - last_residency = cpuidle_get_last_residency(dev) - \ - drv->states[last_idx].exit_latency; - } - else - last_residency = last_state->threshold.promotion_time + 1; + last_residency = cpuidle_get_last_residency(dev) - drv->states[last_idx].exit_latency; /* consider promotion */ if (last_idx < drv->state_count - 1 && @@ -144,7 +139,7 @@ ldev->last_state_idx = CPUIDLE_DRIVER_STATE_START; - for (i = 0; i < drv->state_count; i++) { + for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) { state = &drv->states[i]; lstate = &ldev->states[i]; @@ -156,7 +151,7 @@ if (i < drv->state_count - 1) lstate->threshold.promotion_time = state->exit_latency; - if (i > 0) + if (i > CPUIDLE_DRIVER_STATE_START) lstate->threshold.demotion_time = state->exit_latency; } @@ -170,7 +165,7 @@ */ static void ladder_reflect(struct cpuidle_device *dev, int index) { - struct ladder_device *ldev = &__get_cpu_var(ladder_devices); + struct ladder_device *ldev = this_cpu_ptr(&ladder_devices); if (index > 0) ldev->last_state_idx = index; } @@ -192,14 +187,4 @@ return cpuidle_register_governor(&ladder_governor); } -/** - * exit_ladder - exits the governor - */ -static void __exit exit_ladder(void) -{ - cpuidle_unregister_governor(&ladder_governor); -} - -MODULE_LICENSE("GPL"); -module_init(init_ladder); -module_exit(exit_ladder); +postcore_initcall(init_ladder);