Skip to content

Commit 64df1fd

Browse files
suryasaimadhurafaeljw
authored andcommitted
cpufreq: intel_pstate: Fix an annoying !CONFIG_SMP warning
I keep seeing drivers/cpufreq/intel_pstate.c: In function ‘intel_pstate_init’: drivers/cpufreq/intel_pstate.c:1187:26: warning: initialization from incompatible pointer type struct cpuinfo_x86 *c = &boot_cpu_data; when doing randconfig builds. This is caused by the fact that when !CONFIG_SMP, asm/processor.h defines cpu_info to boot_cpu_data and the local variable struct cpu_defaults *cpu_info overshadows it leading to this unfortunate assignment in the preprocessed source: struct cpu_defaults *boot_cpu_data; struct cpuinfo_x86 *c = &boot_cpu_data; Rename the local variable and use static_cpu_has_safe() which alleviates the need for defining a local cpuinfo_x86 pointer. Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Kristen Carlson Accardi <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 6a82ba6 commit 64df1fd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <asm/div64.h>
3232
#include <asm/msr.h>
3333
#include <asm/cpu_device_id.h>
34+
#include <asm/cpufeature.h>
3435

3536
#define BYT_RATIOS 0x66a
3637
#define BYT_VIDS 0x66b
@@ -1200,8 +1201,7 @@ static int __init intel_pstate_init(void)
12001201
{
12011202
int cpu, rc = 0;
12021203
const struct x86_cpu_id *id;
1203-
struct cpu_defaults *cpu_info;
1204-
struct cpuinfo_x86 *c = &boot_cpu_data;
1204+
struct cpu_defaults *cpu_def;
12051205

12061206
if (no_load)
12071207
return -ENODEV;
@@ -1217,10 +1217,10 @@ static int __init intel_pstate_init(void)
12171217
if (intel_pstate_platform_pwr_mgmt_exists())
12181218
return -ENODEV;
12191219

1220-
cpu_info = (struct cpu_defaults *)id->driver_data;
1220+
cpu_def = (struct cpu_defaults *)id->driver_data;
12211221

1222-
copy_pid_params(&cpu_info->pid_policy);
1223-
copy_cpu_funcs(&cpu_info->funcs);
1222+
copy_pid_params(&cpu_def->pid_policy);
1223+
copy_cpu_funcs(&cpu_def->funcs);
12241224

12251225
if (intel_pstate_msrs_not_valid())
12261226
return -ENODEV;
@@ -1231,7 +1231,7 @@ static int __init intel_pstate_init(void)
12311231
if (!all_cpu_data)
12321232
return -ENOMEM;
12331233

1234-
if (cpu_has(c,X86_FEATURE_HWP) && !no_hwp)
1234+
if (static_cpu_has_safe(X86_FEATURE_HWP) && !no_hwp)
12351235
intel_pstate_hwp_enable();
12361236

12371237
if (!hwp_active && hwp_only)

0 commit comments

Comments
 (0)