Re: [PATCH RFT] x86/hpet: Use another crystalball to evaluate HPET usability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 30 2021 at 13:38, Rafael J. Wysocki wrote:
>> +static bool __init get_mwait_substates(unsigned int *mwait_substates)
>> +{
>> +       unsigned int eax, ebx, ecx;
>> +
>> +       if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
>> +               return false;
>> +
>> +       if (!boot_cpu_has(X86_FEATURE_MWAIT))
>> +               return false;
>> +
>> +       if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
>> +               return false;
>> +
>> +       cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, mwait_substates);
>> +
>> +       if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
>> +           !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ||
>> +           !*mwait_substates)
>> +               return false;
>
> I would do
>
> return (ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) && (ecx &
> CPUID5_ECX_INTERRUPT_BREAK) && *mwait_substates;
>
> And this function could just return the mwait_substates value proper,
> because returning 0 then would be equivalent to returning 'false' from
> it as is.

Let me move that substates check into the function which makes it even simpler.

Thanks,

        tglx



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux