Re: Linux 4.19.0 Build Error when CONFIG_ACPI not set.
From: Dominik Brodowski
Date: Mon Oct 29 2018 - 11:01:33 EST
On Mon, Oct 29, 2018 at 11:53:38AM +0100, Thomas-Mich Richter wrote:
> When I compile the 4.19.0 Linux kernel, I get this build error:
>
> [root@f28 linux]# fgrep -r CONFIG_ACPI .config
> # CONFIG_ACPI is not set
> [root@f28 linux]#
>
> [root@f28 linux]# make
> CALL scripts/checksyscalls.sh
> DESCEND objtool
> CHK include/generated/compile.h
> CC drivers/cpufreq/intel_pstate.o
> drivers/cpufreq/intel_pstate.c: In function âshow_base_frequencyâ:
> drivers/cpufreq/intel_pstate.c:726:10: error: implicit declaration of
> function âintel_pstate_get_cppc_guranteedâ;
> did you mean âintel_pstate_get_eppâ?
> [-Werror=implicit-function-declaration]
> ratio = intel_pstate_get_cppc_guranteed(policy->cpu);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> intel_pstate_get_epp
> cc1: some warnings being treated as errors
> make[2]: *** [scripts/Makefile.build:306: drivers/cpufreq/intel_pstate.o]
> Error 1
> make[1]: *** [scripts/Makefile.build:546: drivers/cpufreq] Error 2
> make: *** [Makefile:1052: drivers] Error 2
> [root@f28 linux]#
>
> I am building on a virtual machine.
>
> This was introduced with
> commit 86d333a8cc7f ("cpufreq: intel_pstate: Add base_frequency attribute")
>
> The function intel_pstate_get_cppc_guranteed() is called but the function
> definition is within #ifdef CONFIG_ACPI/#endif conditional compile.
>
> Any ideas how to fix this?
This isn't in 4.19.0, but in current mainline, and can be fixed by this
patch which is already on its way upstream.
https://patchwork.kernel.org/patch/10653593/
Thanks,
Dominik
----
Date: Tue, 23 Oct 2018 21:54:03 +0200
From: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Subject: [PATCH v2] cpufreq: intel_pstate: Fix compilation for !CONFIG_ACPI
While at it, add a few comments which config options #ifdef
and #else statements refer to.
Fixes: 86d333a8cc7f ("cpufreq: intel_pstate: Add base_frequency attribute")
Cc: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Signed-off-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 49c0abf2d48f..9578312e43f2 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -386,16 +386,11 @@ static int intel_pstate_get_cppc_guranteed(int cpu)
return cppc_perf.guaranteed_perf;
}
-#else
+#else /* CONFIG_ACPI_CPPC_LIB */
static void intel_pstate_set_itmt_prio(int cpu)
{
}
-
-static int intel_pstate_get_cppc_guranteed(int cpu)
-{
- return -ENOTSUPP;
-}
-#endif
+#endif /* CONFIG_ACPI_CPPC_LIB */
static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy)
{
@@ -477,7 +472,7 @@ static void intel_pstate_exit_perf_limits(struct cpufreq_policy *policy)
acpi_processor_unregister_performance(policy->cpu);
}
-#else
+#else /* CONFIG_ACPI */
static inline void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy)
{
}
@@ -490,7 +485,14 @@ static inline bool intel_pstate_acpi_pm_profile_server(void)
{
return false;
}
-#endif
+#endif /* CONFIG_ACPI */
+
+#ifndef CONFIG_ACPI_CPPC_LIB
+static int intel_pstate_get_cppc_guranteed(int cpu)
+{
+ return -ENOTSUPP;
+}
+#endif /* CONFIG_ACPI_CPPC_LIB */
static inline void update_turbo_state(void)
{