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.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -9,7 +9,6 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <linux/sched/topology.h> |
| 10 | 10 | #include <linux/types.h> |
| 11 | 11 | |
| 12 | −#ifdef CONFIG_ENERGY_MODEL | |
| 13 | 12 | /** |
| 14 | 13 | * em_cap_state - Capacity state of a performance domain |
| 15 | 14 | * @frequency: The CPU frequency in KHz, for consistency with CPUFreq |
| @@ -40,6 +39,7 @@ struct em_perf_domain { · 24 unmodified lines | ||
| 40 | 39 | unsigned long cpus[0]; |
| 41 | 40 | }; |
| 42 | 41 | |
| 42 | +#ifdef CONFIG_ENERGY_MODEL | |
| 43 | 43 | #define EM_CPU_MAX_POWER 0xFFFF |
| 44 | 44 | |
| 45 | 45 | struct em_data_callback { |
| @@ -160,7 +160,6 @@ static inline int em_pd_nr_cap_states(struct em_perf_domain *pd) · 114 unmodified lines | ||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | #else |
| 163 | −struct em_perf_domain {}; | |
| 164 | 163 | struct em_data_callback {}; |
| 165 | 164 | #define EM_DATA_CB(_active_power_cb) { } |
| 166 | 165 | |