Skip to content

Commit 8a02d99

Browse files
committed
ACPI: CPPC: Add emtpy stubs of functions for CONFIG_ACPI_CPPC_LIB unset
For convenience, add empty stubs of library functions defined in cppc_acpi.c for the CONFIG_ACPI_CPPC_LIB unset case. Because one of them needs to return CPUFREQ_ETERNAL, include linux/cpufreq.h into the CPPC library header file and drop the direct inclusion of it from cppc_acpi.c. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com>
1 parent 0d02ec6 commit 8a02d99

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

drivers/acpi/cppc_acpi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
#define pr_fmt(fmt) "ACPI CPPC: " fmt
3535

36-
#include <linux/cpufreq.h>
3736
#include <linux/delay.h>
3837
#include <linux/iopoll.h>
3938
#include <linux/ktime.h>

include/acpi/cppc_acpi.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define _CPPC_ACPI_H
1212

1313
#include <linux/acpi.h>
14+
#include <linux/cpufreq.h>
1415
#include <linux/types.h>
1516

1617
#include <acpi/pcc.h>
@@ -132,6 +133,7 @@ struct cppc_cpudata {
132133
cpumask_var_t shared_cpu_map;
133134
};
134135

136+
#ifdef CONFIG_ACPI_CPPC_LIB
135137
extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf);
136138
extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs);
137139
extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls);
@@ -142,5 +144,43 @@ extern unsigned int cppc_get_transition_latency(int cpu);
142144
extern bool cpc_ffh_supported(void);
143145
extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val);
144146
extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val);
147+
#else /* !CONFIG_ACPI_CPPC_LIB */
148+
static inline int cppc_get_desired_perf(int cpunum, u64 *desired_perf)
149+
{
150+
return -ENOTSUPP;
151+
}
152+
static inline int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs)
153+
{
154+
return -ENOTSUPP;
155+
}
156+
static inline int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
157+
{
158+
return -ENOTSUPP;
159+
}
160+
static inline int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps)
161+
{
162+
return -ENOTSUPP;
163+
}
164+
static inline bool acpi_cpc_valid(void)
165+
{
166+
return false;
167+
}
168+
static inline unsigned int cppc_get_transition_latency(int cpu)
169+
{
170+
return CPUFREQ_ETERNAL;
171+
}
172+
static inline bool cpc_ffh_supported(void)
173+
{
174+
return false;
175+
}
176+
static inline int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val)
177+
{
178+
return -ENOTSUPP;
179+
}
180+
static inline int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)
181+
{
182+
return -ENOTSUPP;
183+
}
184+
#endif /* !CONFIG_ACPI_CPPC_LIB */
145185

146186
#endif /* _CPPC_ACPI_H*/

0 commit comments

Comments
 (0)