Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Shaokun Zhang <zhangshaokun@hisilicon.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Marc Zyngier <maz@kernel.org>
Subject: Re: [PATCH] arm64: cpufeature: Use defined macro instead of magic numbers
Date: Thu, 15 Jul 2021 17:31:25 +0100	[thread overview]
Message-ID: <20210715163124.GB1330@willie-the-truck> (raw)
In-Reply-To: <1626243183-32937-1-git-send-email-zhangshaokun@hisilicon.com>

On Wed, Jul 14, 2021 at 02:13:03PM +0800, Shaokun Zhang wrote:
> Macro 'CLIDR_LOUU_SHIFT' and 'CLIDR_LOUIS_SHIFT' are defined, so use
> these to replace the magic numbers.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> ---
>  arch/arm64/kernel/cpufeature.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index 125d5c9471ac..4ee3496bcff8 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -1733,7 +1733,7 @@ static void cpu_has_fwb(const struct arm64_cpu_capabilities *__unused)
>  	u64 val = read_sysreg_s(SYS_CLIDR_EL1);
>  
>  	/* Check that CLIDR_EL1.LOU{U,IS} are both 0 */
> -	WARN_ON(val & (7 << 27 | 7 << 21));
> +	WARN_ON(val & (7 << CLIDR_LOUU_SHIFT | 7 << CLIDR_LOUIS_SHIFT));
>  }

I think this would be even better as:

	WARN_ON(CLIDR_LOUU(val) || CLIDR_LOUIS(val));

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-07-15 16:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  6:13 [PATCH] arm64: cpufeature: Use defined macro instead of magic numbers Shaokun Zhang
2021-07-15 16:31 ` Will Deacon [this message]
2021-07-16  1:09   ` Shaokun Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210715163124.GB1330@willie-the-truck \
    --to=will@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=zhangshaokun@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox