Skip to content

Commit 5f75916

Browse files
KAGA-KOKObp3tk0v
authored andcommitted
x86/idle: Let prefer_mwait_c1_over_halt() return bool
The return value is truly boolean. Make it so. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20240229142248.518723854@linutronix.de
1 parent f3d7eab commit 5f75916

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/x86/kernel/process.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -853,21 +853,21 @@ void __noreturn stop_this_cpu(void *dummy)
853853
* Do not prefer MWAIT if MONITOR instruction has a bug or idle=nomwait
854854
* is passed to kernel commandline parameter.
855855
*/
856-
static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
856+
static bool prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
857857
{
858858
u32 eax, ebx, ecx, edx;
859859

860860
/* If override is enforced on the command line, fall back to HALT. */
861861
if (boot_option_idle_override != IDLE_NO_OVERRIDE)
862-
return 0;
862+
return false;
863863

864864
/* MWAIT is not supported on this platform. Fallback to HALT */
865865
if (!cpu_has(c, X86_FEATURE_MWAIT))
866-
return 0;
866+
return false;
867867

868868
/* Monitor has a bug or APIC stops in C1E. Fallback to HALT */
869869
if (boot_cpu_has_bug(X86_BUG_MONITOR) || boot_cpu_has_bug(X86_BUG_AMD_APIC_C1E))
870-
return 0;
870+
return false;
871871

872872
cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
873873

@@ -876,13 +876,13 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
876876
* with EAX=0, ECX=0.
877877
*/
878878
if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED))
879-
return 1;
879+
return true;
880880

881881
/*
882882
* If MWAIT extensions are available, there should be at least one
883883
* MWAIT C1 substate present.
884884
*/
885-
return (edx & MWAIT_C1_SUBSTATE_MASK);
885+
return !!(edx & MWAIT_C1_SUBSTATE_MASK);
886886
}
887887

888888
/*

0 commit comments

Comments
 (0)