Merge tag 'io_uring-5.15-2021-09-11' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / drivers / cpufreq / cpufreq.c
index 06c526d..5782b15 100644 (file)
@@ -1491,6 +1491,19 @@ static int cpufreq_online(unsigned int cpu)
                write_lock_irqsave(&cpufreq_driver_lock, flags);
                list_add(&policy->policy_list, &cpufreq_policy_list);
                write_unlock_irqrestore(&cpufreq_driver_lock, flags);
+
+               /*
+                * Register with the energy model before
+                * sched_cpufreq_governor_change() is called, which will result
+                * in rebuilding of the sched domains, which should only be done
+                * once the energy model is properly initialized for the policy
+                * first.
+                *
+                * Also, this should be called before the policy is registered
+                * with cooling framework.
+                */
+               if (cpufreq_driver->register_em)
+                       cpufreq_driver->register_em(policy);
        }
 
        ret = cpufreq_init_policy(policy);
@@ -1504,10 +1517,6 @@ static int cpufreq_online(unsigned int cpu)
 
        kobject_uevent(&policy->kobj, KOBJ_ADD);
 
-       /* Callback for handling stuff after policy is ready */
-       if (cpufreq_driver->ready)
-               cpufreq_driver->ready(policy);
-
        if (cpufreq_thermal_control_enabled(cpufreq_driver))
                policy->cdev = of_cpufreq_cooling_register(policy);