Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM: EM: Change the order of arguments in the .active_power() callback

The .active_power() callback passes the device pointer when it's called.
Aligned with a convetion present in other subsystems and pass the 'dev'
as a first argument. It looks more cleaner.

Adjust all affected drivers which implement that API callback.

Suggested-by: Ionela Voinescu <ionela.voinescu@arm.com>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Reviewed-by: Ionela Voinescu <ionela.voinescu@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Lukasz Luba and committed by
Rafael J. Wysocki
75a3a99a 91362463

+13 -13
+2 -2
Documentation/power/energy-model.rst
··· 181 181 182 182 -> drivers/cpufreq/foo_cpufreq.c 183 183 184 - 01 static int est_power(unsigned long *mW, unsigned long *KHz, 185 - 02 struct device *dev) 184 + 01 static int est_power(struct device *dev, unsigned long *mW, 185 + 02 unsigned long *KHz) 186 186 03 { 187 187 04 long freq, power; 188 188 05
+2 -2
drivers/cpufreq/mediatek-cpufreq-hw.c
··· 51 51 }; 52 52 53 53 static int __maybe_unused 54 - mtk_cpufreq_get_cpu_power(unsigned long *mW, 55 - unsigned long *KHz, struct device *cpu_dev) 54 + mtk_cpufreq_get_cpu_power(struct device *cpu_dev, unsigned long *mW, 55 + unsigned long *KHz) 56 56 { 57 57 struct mtk_cpufreq_data *data; 58 58 struct cpufreq_policy *policy;
+2 -2
drivers/cpufreq/scmi-cpufreq.c
··· 96 96 } 97 97 98 98 static int __maybe_unused 99 - scmi_get_cpu_power(unsigned long *power, unsigned long *KHz, 100 - struct device *cpu_dev) 99 + scmi_get_cpu_power(struct device *cpu_dev, unsigned long *power, 100 + unsigned long *KHz) 101 101 { 102 102 unsigned long Hz; 103 103 int ret, domain;
+3 -3
drivers/opp/of.c
··· 1448 1448 * Returns 0 on success or a proper -EINVAL value in case of error. 1449 1449 */ 1450 1450 static int __maybe_unused 1451 - _get_dt_power(unsigned long *mW, unsigned long *kHz, struct device *dev) 1451 + _get_dt_power(struct device *dev, unsigned long *mW, unsigned long *kHz) 1452 1452 { 1453 1453 struct dev_pm_opp *opp; 1454 1454 unsigned long opp_freq, opp_power; ··· 1482 1482 * Returns -EINVAL if the power calculation failed because of missing 1483 1483 * parameters, 0 otherwise. 1484 1484 */ 1485 - static int __maybe_unused _get_power(unsigned long *mW, unsigned long *kHz, 1486 - struct device *dev) 1485 + static int __maybe_unused _get_power(struct device *dev, unsigned long *mW, 1486 + unsigned long *kHz) 1487 1487 { 1488 1488 struct dev_pm_opp *opp; 1489 1489 struct device_node *np;
+3 -3
include/linux/energy_model.h
··· 101 101 /** 102 102 * active_power() - Provide power at the next performance state of 103 103 * a device 104 + * @dev : Device for which we do this operation (can be a CPU) 104 105 * @power : Active power at the performance state 105 106 * (modified) 106 107 * @freq : Frequency at the performance state in kHz 107 108 * (modified) 108 - * @dev : Device for which we do this operation (can be a CPU) 109 109 * 110 110 * active_power() must find the lowest performance state of 'dev' above 111 111 * 'freq' and update 'power' and 'freq' to the matching active power ··· 117 117 * 118 118 * Return 0 on success. 119 119 */ 120 - int (*active_power)(unsigned long *power, unsigned long *freq, 121 - struct device *dev); 120 + int (*active_power)(struct device *dev, unsigned long *power, 121 + unsigned long *freq); 122 122 123 123 /** 124 124 * get_cost() - Provide the cost at the given performance state of
+1 -1
kernel/power/energy_model.c
··· 140 140 * lowest performance state of 'dev' above 'freq' and updates 141 141 * 'power' and 'freq' accordingly. 142 142 */ 143 - ret = cb->active_power(&power, &freq, dev); 143 + ret = cb->active_power(dev, &power, &freq); 144 144 if (ret) { 145 145 dev_err(dev, "EM: invalid perf. state: %d\n", 146 146 ret);