Skip to content

Commit caeea9e

Browse files
lukaszluba-armvireshk
authored andcommitted
PM: EM: add macro to set .active_power() callback conditionally
The Energy Model is able to use new power values coming from DT. Add a new macro which is helpful in setting the .active_power() callback conditionally in setup time. The dual-macro implementation handles both kernel configurations: w/ EM and w/o EM built-in. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 4f9a7a1 commit caeea9e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/linux/energy_model.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ struct em_data_callback {
116116
struct device *dev);
117117
};
118118
#define EM_DATA_CB(_active_power_cb) { .active_power = &_active_power_cb }
119+
#define EM_SET_ACTIVE_POWER_CB(em_cb, cb) ((em_cb).active_power = cb)
119120

120121
struct em_perf_domain *em_cpu_get(int cpu);
121122
struct em_perf_domain *em_pd_get(struct device *dev);
@@ -264,6 +265,7 @@ static inline int em_pd_nr_perf_states(struct em_perf_domain *pd)
264265
#else
265266
struct em_data_callback {};
266267
#define EM_DATA_CB(_active_power_cb) { }
268+
#define EM_SET_ACTIVE_POWER_CB(em_cb, cb) do { } while (0)
267269

268270
static inline
269271
int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,

0 commit comments

Comments
 (0)