All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Liao Chang <liaochang1@huawei.com>
Cc: catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org,
	maz@kernel.org, joey.gouly@arm.com, kristina.martsenko@arm.com,
	ryan.roberts@arm.com, jeremy.linton@arm.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: cpufeatures: Clean up temporary variable to simplify code
Date: Thu, 29 Feb 2024 11:10:37 +0000	[thread overview]
Message-ID: <ZeBmLc9bLhT5qfrB@FVFF77S0Q05N> (raw)
In-Reply-To: <20240229105208.456704-1-liaochang1@huawei.com>

On Thu, Feb 29, 2024 at 10:52:08AM +0000, Liao Chang wrote:
> Clean up one temporary variable to simplifiy code in capability
> detection.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>

This looks line a nice cleanup, so:

Acked-by: Mark Rutland <mark.rutland@arm.com>

For context, we removed the last other user of 'num' in commit:

  21fb26bfb01ffe0d ("arm64: alternatives: add alternative_has_feature_*()")

Mark.

> ---
>  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)
> -- 
> 2.34.1
> 

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

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Liao Chang <liaochang1@huawei.com>
Cc: catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org,
	maz@kernel.org, joey.gouly@arm.com, kristina.martsenko@arm.com,
	ryan.roberts@arm.com, jeremy.linton@arm.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: cpufeatures: Clean up temporary variable to simplify code
Date: Thu, 29 Feb 2024 11:10:37 +0000	[thread overview]
Message-ID: <ZeBmLc9bLhT5qfrB@FVFF77S0Q05N> (raw)
In-Reply-To: <20240229105208.456704-1-liaochang1@huawei.com>

On Thu, Feb 29, 2024 at 10:52:08AM +0000, Liao Chang wrote:
> Clean up one temporary variable to simplifiy code in capability
> detection.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>

This looks line a nice cleanup, so:

Acked-by: Mark Rutland <mark.rutland@arm.com>

For context, we removed the last other user of 'num' in commit:

  21fb26bfb01ffe0d ("arm64: alternatives: add alternative_has_feature_*()")

Mark.

> ---
>  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)
> -- 
> 2.34.1
> 

  reply	other threads:[~2024-02-29 11:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 10:52 [PATCH] arm64: cpufeatures: Clean up temporary variable to simplify code Liao Chang
2024-02-29 10:52 ` Liao Chang
2024-02-29 11:10 ` Mark Rutland [this message]
2024-02-29 11:10   ` Mark Rutland
2024-03-01 18:29 ` Catalin Marinas
2024-03-01 18:29   ` Catalin Marinas
2024-03-01 19:46 ` Jeremy Linton
2024-03-01 19:46   ` Jeremy Linton

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=ZeBmLc9bLhT5qfrB@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=jeremy.linton@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kristina.martsenko@arm.com \
    --cc=liaochang1@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.