Skip to content

Commit 27a47e4

Browse files
Quentin Perretdlezcano
authored andcommitted
PM / EM: Declare EM data types unconditionally
The structs representing capacity states and performance domains of an Energy Model are currently only defined for CONFIG_ENERGY_MODEL=y. That makes it hard for code outside PM_EM to manipulate those structures without a lot of ifdefery or stubbed accessors. So, move the declaration of the two structs outside of the CONFIG_ENERGY_MODEL ifdef. The client code (e.g. EAS or thermal) always checks the return of em_cpu_get() before using it, so the exising code is still safe to use as-is. Reported-by: kbuild test robot <[email protected]> Signed-off-by: Quentin Perret <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 48da6f8 commit 27a47e4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

include/linux/energy_model.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <linux/sched/topology.h>
1010
#include <linux/types.h>
1111

12-
#ifdef CONFIG_ENERGY_MODEL
1312
/**
1413
* em_cap_state - Capacity state of a performance domain
1514
* @frequency: The CPU frequency in KHz, for consistency with CPUFreq
@@ -40,6 +39,7 @@ struct em_perf_domain {
4039
unsigned long cpus[0];
4140
};
4241

42+
#ifdef CONFIG_ENERGY_MODEL
4343
#define EM_CPU_MAX_POWER 0xFFFF
4444

4545
struct em_data_callback {
@@ -160,7 +160,6 @@ static inline int em_pd_nr_cap_states(struct em_perf_domain *pd)
160160
}
161161

162162
#else
163-
struct em_perf_domain {};
164163
struct em_data_callback {};
165164
#define EM_DATA_CB(_active_power_cb) { }
166165

0 commit comments

Comments
 (0)