From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44AB9C433F5 for ; Thu, 30 Sep 2021 17:07:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 206F361881 for ; Thu, 30 Sep 2021 17:07:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351214AbhI3RI7 (ORCPT ); Thu, 30 Sep 2021 13:08:59 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:51430 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349614AbhI3RI6 (ORCPT ); Thu, 30 Sep 2021 13:08:58 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1633021634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LPr7/T/rWcJwssj7Csqjd9LQAoR0LbS0++w2zDmkKyI=; b=2LLroHCNp5+mkq+qW/QBbtaLNBY57VQJVJumrb5dTZGJvhQrIOrVqozYI2KKbbBgdMNkrN 0DUzWIOpsCX9BXu/xai9R+S/F6XLqpLT4BMXSKAOGbUDxn5aFDsBmq/z9MWCSk1Vc0TEtm HEUq0j95Sn+A3strkq2FejgVWnj+9PFiWYNmI/evi/ZjQ/sOuWD3qLHFJMa+F4SvT+20ao UGb8d28pRT7Z7JpT1lPwL0vawMrmjXS3LhWrFdsyUEcY/qAGk5jBvLR6UeYm8EHki+PBMH 2S0wqnTz5fKCE0rJDbnNqFqQN+icXNuQgrAF1kwiPZ6kQJT3OwMrT/3xIY1lIA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1633021634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LPr7/T/rWcJwssj7Csqjd9LQAoR0LbS0++w2zDmkKyI=; b=/YRRHYQDWItKGoXgJplNGK9pUcSwd2GzCNxKrvM2Z8mupJ3LZF9ptOEJJsmQU2A1JvENpp RgqN7ZoHL4wcC2DQ== To: "Rafael J. Wysocki" Cc: Bjorn Helgaas , Jakub Kicinski , the arch/x86 maintainers , jose.souza@intel.com, "H. Peter Anvin" , Borislav Petkov , Ingo Molnar , Kai-Heng Feng , Bjorn Helgaas , Linux PCI , rudolph@fb.com, xapienz@fb.com, bmilton@fb.com, "Paul E. McKenney" , Stable , "Rafael J. Wysocki" , Dave Hansen , Feng Tang , Harry Pan Subject: Re: [PATCH RFT] x86/hpet: Use another crystalball to evaluate HPET usability In-Reply-To: References: <20210929160550.GA773748@bhelgaas> <87mtnu77mr.ffs@tglx> <87k0iy71rw.ffs@tglx> Date: Thu, 30 Sep 2021 19:07:14 +0200 Message-ID: <87h7e26lh9.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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