PM: EM: Move CPU capacity check to em_adjust_new_capacity()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 6 May 2025 20:39:35 +0000 (22:39 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 13 May 2025 12:34:18 +0000 (14:34 +0200)
commit3e3ba654d3097e0031f2add215b12ff81c23814e
treea7679c23ad463d9453849aeac013a8e4ee3c9530
parentc9b83cbe46c645712988a53ce513aaf56728dcd3
PM: EM: Move CPU capacity check to em_adjust_new_capacity()

Move the check of the CPU capacity currently stored in the energy model
against the arch_scale_cpu_capacity() value to em_adjust_new_capacity()
so it will be done regardless of where the latter is called from.

This will be useful when a new em_adjust_new_capacity() caller is added
subsequently.

While at it, move the pd local variable declaration in
em_check_capacity_update() into the loop in which it is used.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://patch.msgid.link/7810787.EvYhyI6sBW@rjwysocki.net
kernel/power/energy_model.c