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
9#include <linux/sched/topology.h>9#include <linux/sched/topology.h>
10#include <linux/types.h>10#include <linux/types.h>
11 11
12#ifdef CONFIG_ENERGY_MODEL
13/**12/**
14 * em_cap_state - Capacity state of a performance domain13 * em_cap_state - Capacity state of a performance domain
15 * @frequency: The CPU frequency in KHz, for consistency with CPUFreq14 * @frequency: The CPU frequency in KHz, for consistency with CPUFreq
@@ -40,6 +39,7 @@ struct em_perf_domain { · 24 unmodified lines
40 unsigned long cpus[0];39 unsigned long cpus[0];
41};40};
42 41
42#ifdef CONFIG_ENERGY_MODEL
43#define EM_CPU_MAX_POWER 0xFFFF43#define EM_CPU_MAX_POWER 0xFFFF
44 44
45struct em_data_callback {45struct 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#else162#else
163struct em_perf_domain {};
164struct em_data_callback {};163struct em_data_callback {};
165#define EM_DATA_CB(_active_power_cb) { }164#define EM_DATA_CB(_active_power_cb) { }
166 165

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