summaryrefslogtreecommitdiff
path: root/kernel/power
diff options
context:
space:
mode:
authorLukasz Luba <lukasz.luba@arm.com>2020-05-27 10:58:49 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2020-06-24 17:14:07 +0200
commitd0351cc3b0f57214d157e4d589564730af2aedae (patch)
tree531c25149cf9c2305f2d3a20c5d594b0114ae12e /kernel/power
parent7d9895c7fbfc9c70afce7029b7de0f3f974adb88 (diff)
PM / EM: update callback structure and add device pointer
The Energy Model framework is going to support devices other that CPUs. In order to make this happen change the callback function and add pointer to a device as an argument. Update the related users to use new function and new callback from the Energy Model. Acked-by: Quentin Perret <qperret@google.com> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/energy_model.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index 875b163e54ab..5b8a1566526a 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -78,8 +78,9 @@ core_initcall(em_debug_init);
#else /* CONFIG_DEBUG_FS */
static void em_debug_create_pd(struct em_perf_domain *pd, int cpu) {}
#endif
-static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states,
- struct em_data_callback *cb)
+static struct em_perf_domain *
+em_create_pd(struct device *dev, int nr_states, struct em_data_callback *cb,
+ cpumask_t *span)
{
unsigned long opp_eff, prev_opp_eff = ULONG_MAX;
unsigned long power, freq, prev_freq = 0;
@@ -106,7 +107,7 @@ static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states,
* lowest performance state of 'cpu' above 'freq' and updates
* 'power' and 'freq' accordingly.
*/
- ret = cb->active_power(&power, &freq, cpu);
+ ret = cb->active_power(&power, &freq, dev);
if (ret) {
pr_err("pd%d: invalid perf. state: %d\n", cpu, ret);
goto free_ps_table;
@@ -237,7 +238,7 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
}
/* Create the performance domain and add it to the Energy Model. */
- pd = em_create_pd(span, nr_states, cb);
+ pd = em_create_pd(dev, nr_states, cb, span);
if (!pd) {
ret = -EINVAL;
goto unlock;