History

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.

Quentin Perret committed 7 years ago

Commit 27a47e41 parent 48da6f81 file · +1 −2Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/energy_model.h+1−2
@@ -9,7 +9,6 @@ · 8 unmodified lines
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 { · 24 unmodified lines
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) · 114 unmodified lines
160160 }
161161
162162 #else
163−struct em_perf_domain {};
164163 struct em_data_callback {};
165164 #define EM_DATA_CB(_active_power_cb) { }
166165

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t