Skip to content

Commit da43634

Browse files
pierregondoisrafaeljw
authored andcommitted
cpufreq: CPPC: Fix unused-function warning
Building the cppc_cpufreq driver with for arm64 with CONFIG_ENERGY_MODEL=n triggers the following warnings: drivers/cpufreq/cppc_cpufreq.c:550:12: error: ‘cppc_get_cpu_cost’ defined but not used [-Werror=unused-function] 550 | static int cppc_get_cpu_cost(struct device *cpu_dev, unsigned long KHz, | ^~~~~~~~~~~~~~~~~ drivers/cpufreq/cppc_cpufreq.c:481:12: error: ‘cppc_get_cpu_power’ defined but not used [-Werror=unused-function] 481 | static int cppc_get_cpu_power(struct device *cpu_dev, | ^~~~~~~~~~~~~~~~~~ Move the Energy Model related functions into specific guards. This allows to fix the warning and prevent doing extra work when the Energy Model is not present. Fixes: 740fcdc ("cpufreq: CPPC: Register EM based on efficiency class information") Reported-by: Shaokun Zhang <[email protected]> Signed-off-by: Pierre Gondois <[email protected]> Tested-by: Shaokun Zhang <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent a3f083e commit da43634

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,14 @@ static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
441441
}
442442
return cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
443443
}
444+
#else
445+
static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
446+
{
447+
return cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
448+
}
449+
#endif
450+
451+
#if defined(CONFIG_ARM64) && defined(CONFIG_ENERGY_MODEL)
444452

445453
static DEFINE_PER_CPU(unsigned int, efficiency_class);
446454
static void cppc_cpufreq_register_em(struct cpufreq_policy *policy);
@@ -621,21 +629,12 @@ static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
621629
}
622630

623631
#else
624-
625-
static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
626-
{
627-
return cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
628-
}
629632
static int populate_efficiency_class(void)
630633
{
631634
return 0;
632635
}
633-
static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
634-
{
635-
}
636636
#endif
637637

638-
639638
static struct cppc_cpudata *cppc_cpufreq_get_cpu_data(unsigned int cpu)
640639
{
641640
struct cppc_cpudata *cpu_data;

0 commit comments

Comments
 (0)