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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0166EC5475B for ; Fri, 1 Mar 2024 19:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L3Dl8Yq2TxWO+9Uh4DSBEGMSLP41APrvC5ngn4OvOig=; b=YzQtXgNC4aY+1j shEPmac/RuIPJOKZomMzy8ZGOzrWA4YwEZzAcpJxRdlXL25Dxu6HAsPZHKSwkPuxYzsV2HaOBaz6f sLHJxALL19Q07nGSkrwFmVVDhLHnuIMIKkVTgqJZ20VhLE3D8fMNHiP8yRhamm5kDpkoLFIfNJcd/ g/ORnGhavRwKCEvANJHVdIlhiuin+kaSxqfBzFirJENnD0u31hTQ/T08w8H+0VIhmu8LVTmorzOTE +B+mVrB2wbAt7qcEen2IIJoQ5lNNipthWC0SbH2BAEhLiNVgL+vEKrvwn3nfOeCPn4/z7G9zvPrbN VEEl6+7Vo0n/Iy6m5+Wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rg8qL-00000001mlm-0097; Fri, 01 Mar 2024 19:46:53 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rg8qI-00000001mkU-0bA6 for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2024 19:46:51 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 40ED011FB; Fri, 1 Mar 2024 11:47:25 -0800 (PST) Received: from [172.27.42.98] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0AD1C3F6C4; Fri, 1 Mar 2024 11:46:47 -0800 (PST) Message-ID: Date: Fri, 1 Mar 2024 13:46:36 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] arm64: cpufeatures: Clean up temporary variable to simplify code Content-Language: en-US To: Liao Chang , catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, mark.rutland@arm.com, maz@kernel.org, joey.gouly@arm.com, kristina.martsenko@arm.com, ryan.roberts@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240229105208.456704-1-liaochang1@huawei.com> From: Jeremy Linton In-Reply-To: <20240229105208.456704-1-liaochang1@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240301_114650_357028_7F47F745 X-CRM114-Status: GOOD ( 16.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On 2/29/24 04:52, Liao Chang wrote: > Clean up one temporary variable to simplifiy code in capability > detection. > > Signed-off-by: Liao Chang > --- > arch/arm64/kernel/cpufeature.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index 8d1a634a403e..0e900b23f7ab 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -3052,13 +3052,9 @@ static void __init enable_cpu_capabilities(u16 scope_mask) > boot_scope = !!(scope_mask & SCOPE_BOOT_CPU); > > for (i = 0; i < ARM64_NCAPS; i++) { > - unsigned int num; > - > caps = cpucap_ptrs[i]; > - if (!caps || !(caps->type & scope_mask)) > - continue; > - num = caps->capability; > - if (!cpus_have_cap(num)) > + if (!caps || !(caps->type & scope_mask) || > + !cpus_have_cap(caps->capability)) > continue; > > if (boot_scope && caps->cpu_enable) Looks functionality equivalent to me, and just to see if it makes a binary difference I compiled both variations (gcc 14.0.1) and they do result in the same instruction sequence. Meaning gcc is smart enough to drop the tmp, its also smart enough equate/apply de Morgan's law. The latter might make it more readable too, but I guess its all a matter of taste. Reviewed-by: Jeremy Linton _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel