Skip to contentSkip to conversation

cpufreq: intel_pstate: Fix compilation for !CONFIG_ACPI

PATCH Superseded Dominik Brodowski 3 participants 7 messages Oct 23, 2018 – Oct 26, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: intel_pstate: Fix compilation for !CONFIG_ACPI

Fixes 86d333a8cc7f ("cpufreq: intel_pstate: Add base_frequency attribute")
Cc Srinivas Pandruvada <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Len Brown <[email protected]>
drivers/cpufreq/intel_pstate.c +5 -5
index 49c0abf2d48f..50c5699970c5 100644
@@ -390,11 +390,6 @@ static int intel_pstate_get_cppc_guranteed(int cpu)
 static void intel_pstate_set_itmt_prio(int cpu)
 {
 }
-
-static int intel_pstate_get_cppc_guranteed(int cpu)
-{
-	return -ENOTSUPP;
-}
 #endif
 
 static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy)
@@ -490,6 +485,11 @@ static inline bool intel_pstate_acpi_pm_profile_server(void)
 {
 	return false;
 }
+
+static int intel_pstate_get_cppc_guranteed(int cpu)
+{
+	return -ENOTSUPP;
+}
 #endif
 
 static inline void update_turbo_state(void)
#1 lore raw
Quoted 2 lines · Dominik Brodowski
Fixes 86d333a8cc7f ("cpufreq: intel_pstate: Add base_frequency

attribute")

Thanks for the fix.

Quoted 11 lines
Cc Srinivas Pandruvada <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Len Brown <[email protected]>
drivers/cpufreq/intel_pstate.c +0 -0
index 49c0abf2d48f..50c5699970c5 100644

drivers/cpufreq/intel_pstate.c static int intel_pstate_get_cppc_guranteed(int · line 398

Quoted 9 lines
drivers/cpufreq/intel_pstate.c +0 -5
@@ -390,11 +390,6 @@ static int intel_pstate_get_cppc_guranteed(int
 cpu)
 static void intel_pstate_set_itmt_prio(int cpu)
 {
 }
-
-static int intel_pstate_get_cppc_guranteed(int cpu)
-{
-	return -ENOTSUPP;
-}

What is ACPI is defined but SCHED_MC_PRIO is not defined? Based on
"select ACPI_CPPC_LIB if X86_64 && ACPI && SCHED_MC_PRIO"

So the above is still required. correct?

Quoted 17 lines
drivers/cpufreq/intel_pstate.c +0 -0
 #endif
 

static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy
*policy)

drivers/cpufreq/intel_pstate.c +5 -0
@@ -490,6 +485,11 @@ static inline bool
 intel_pstate_acpi_pm_profile_server(void)
 {
 	return false;
 }
+
+static int intel_pstate_get_cppc_guranteed(int cpu)
+{
+	return -ENOTSUPP;
+}
 #endif
 

static inline void update_turbo_state(void)

#2 lore raw
Quoted 29 lines · Srinivas Pandruvada
Quoted 2 lines · Dominik Brodowski
Fixes 86d333a8cc7f ("cpufreq: intel_pstate: Add base_frequency

attribute")

Thanks for the fix.

Quoted 11 lines
Cc Srinivas Pandruvada <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Len Brown <[email protected]>
drivers/cpufreq/intel_pstate.c +0 -0
index 49c0abf2d48f..50c5699970c5 100644

drivers/cpufreq/intel_pstate.c static int intel_pstate_get_cppc_guranteed(int · line 398

Quoted 9 lines
drivers/cpufreq/intel_pstate.c +0 -5
@@ -390,11 +390,6 @@ static int intel_pstate_get_cppc_guranteed(int
 cpu)
 static void intel_pstate_set_itmt_prio(int cpu)
 {
 }
-
-static int intel_pstate_get_cppc_guranteed(int cpu)
-{
-	return -ENOTSUPP;
-}

What is ACPI is defined but SCHED_MC_PRIO is not defined? Based on
"select ACPI_CPPC_LIB if X86_64 && ACPI && SCHED_MC_PRIO"

Quoted 1 line

So the above is still required. correct?

Seems so, yes. Though that leads to either complicated #ifdefs or code duplications.

In any case, I'd suggest marking at least nested #else and #endif lines with comments denoting which #ifdef they relate to, e.g.

	#else	/* CONFIG_ACPI */
	#endif	/* CONFIG_ACPI */

Thanks,
Dominik

#3 lore raw
Quoted 39 lines · Dominik Brodowski
Quoted 32 lines · Srinivas Pandruvada
Quoted 2 lines · Dominik Brodowski
Fixes 86d333a8cc7f ("cpufreq: intel_pstate: Add base_frequency

attribute")

Thanks for the fix.

Quoted 16 lines
Cc Srinivas Pandruvada <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Len Brown <[email protected]>
drivers/cpufreq/intel_pstate.c +0 -0
index 49c0abf2d48f..50c5699970c5 100644
@@ -390,11 +390,6 @@ static int

intel_pstate_get_cppc_guranteed(int
cpu)
static void intel_pstate_set_itmt_prio(int cpu)
{
}

drivers/cpufreq/intel_pstate.c static int intel_pstate_get_cppc_guranteed(int cpu) · line 397

Quoted 5 lines
drivers/cpufreq/intel_pstate.c +0 -5
-
-static int intel_pstate_get_cppc_guranteed(int cpu)
-{
-	return -ENOTSUPP;
-}

What is ACPI is defined but SCHED_MC_PRIO is not defined? Based on
"select ACPI_CPPC_LIB if X86_64 && ACPI && SCHED_MC_PRIO"

Quoted 1 line

So the above is still required. correct?

Seems so, yes. Though that leads to either complicated #ifdefs or code
duplications.

Quoted 6 lines

In any case, I'd suggest marking at least nested #else and #endif lines
with comments denoting which #ifdef they relate to, e.g.

	#else	/* CONFIG_ACPI */
	#endif	/* CONFIG_ACPI */

Will you submit a change?

Thanks,
Srinivas

Quoted 3 lines

Thanks,
Dominik

#4 lore raw

PATCH v2 1/1 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 <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
drivers/cpufreq/intel_pstate.c +11 -9
index 49c0abf2d48f..9578312e43f2 100644
@@ -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)
 {
maintainer Acked-by on v2 1/1
#5 lore raw
Quoted 8 lines · Dominik Brodowski

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 <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Quoted 55 lines
drivers/cpufreq/intel_pstate.c +2 -7
index 49c0abf2d48f..9578312e43f2 100644
@@ -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)
{

drivers/cpufreq/intel_pstate.c +1 -1
@@ -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)

{
}

drivers/cpufreq/intel_pstate.c +8 -1
@@ -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)

{

#6 lore raw
Quoted 64 lines · CEST Srinivas Pandruvada
Quoted 8 lines · Dominik Brodowski

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 <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Quoted 53 lines
drivers/cpufreq/intel_pstate.c +2 -7
index 49c0abf2d48f..9578312e43f2 100644
@@ -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)
{

drivers/cpufreq/intel_pstate.c +1 -1
@@ -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)

{
}

drivers/cpufreq/intel_pstate.c +8 -1
@@ -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 */
 
Quoted 4 lines
Quoted 2 lines
drivers/cpufreq/intel_pstate.c +0 -0
 static inline void update_turbo_state(void)

{

Patch applied, thanks!