All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Marc Zyngier <maz@kernel.org>,
	Amit Daniel Kachhap <amit.kachhap@arm.com>,
	Denis Efremov <efremov@linux.com>,
	kbuild-all@lists.01.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: cpufeatures: use min and max
Date: Fri, 30 Apr 2021 12:49:35 +0100	[thread overview]
Message-ID: <20210430114935.GB53304@C02TD0UTHF1T.local> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2104292246300.16899@hadrien>

On Thu, Apr 29, 2021 at 10:50:46PM +0200, Julia Lawall wrote:
> From: kernel test robot <lkp@intel.com>
> 
> Use min and max to make the effect more clear.
> 
> Generated by: scripts/coccinelle/misc/minmax.cocci
> 
> Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script")
> CC: Denis Efremov <efremov@linux.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>

This looks like a nice cleanup, but it's not clear to me what the
intended inclusion path for this is, and to avoid fragility I think we
must include <linux/minmax.h> explicitly.

With that:

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

Thanks,
Mark.

> ---
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git for-5.12
> head:   44e793b89bcfe586730f4c6ce3c66174dc07cb37
> commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/5] coccinelle: misc: add minmax script
> :::::: branch date: 6 days ago
> :::::: commit date: 6 weeks ago
> 
>  cpufeature.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -695,14 +695,14 @@ static s64 arm64_ftr_safe_value(const st
>  		ret = ftrp->safe_val;
>  		break;
>  	case FTR_LOWER_SAFE:
> -		ret = new < cur ? new : cur;
> +		ret = min(new, cur);
>  		break;
>  	case FTR_HIGHER_OR_ZERO_SAFE:
>  		if (!cur || !new)
>  			break;
>  		fallthrough;
>  	case FTR_HIGHER_SAFE:
> -		ret = new > cur ? new : cur;
> +		ret = max(new, cur);
>  		break;
>  	default:
>  		BUG();

_______________________________________________
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: kbuild-all@lists.01.org
Subject: Re: [PATCH] arm64: cpufeatures: use min and max
Date: Fri, 30 Apr 2021 12:49:35 +0100	[thread overview]
Message-ID: <20210430114935.GB53304@C02TD0UTHF1T.local> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2104292246300.16899@hadrien>

[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]

On Thu, Apr 29, 2021 at 10:50:46PM +0200, Julia Lawall wrote:
> From: kernel test robot <lkp@intel.com>
> 
> Use min and max to make the effect more clear.
> 
> Generated by: scripts/coccinelle/misc/minmax.cocci
> 
> Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script")
> CC: Denis Efremov <efremov@linux.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>

This looks like a nice cleanup, but it's not clear to me what the
intended inclusion path for this is, and to avoid fragility I think we
must include <linux/minmax.h> explicitly.

With that:

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

Thanks,
Mark.

> ---
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git for-5.12
> head:   44e793b89bcfe586730f4c6ce3c66174dc07cb37
> commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/5] coccinelle: misc: add minmax script
> :::::: branch date: 6 days ago
> :::::: commit date: 6 weeks ago
> 
>  cpufeature.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -695,14 +695,14 @@ static s64 arm64_ftr_safe_value(const st
>  		ret = ftrp->safe_val;
>  		break;
>  	case FTR_LOWER_SAFE:
> -		ret = new < cur ? new : cur;
> +		ret = min(new, cur);
>  		break;
>  	case FTR_HIGHER_OR_ZERO_SAFE:
>  		if (!cur || !new)
>  			break;
>  		fallthrough;
>  	case FTR_HIGHER_SAFE:
> -		ret = new > cur ? new : cur;
> +		ret = max(new, cur);
>  		break;
>  	default:
>  		BUG();

  reply	other threads:[~2021-04-30 11:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 20:50 [PATCH] arm64: cpufeatures: use min and max Julia Lawall
2021-04-29 20:50 ` Julia Lawall
2021-04-30 11:49 ` Mark Rutland [this message]
2021-04-30 11:49   ` Mark Rutland
2021-04-30 17:38 ` Catalin Marinas
2021-04-30 17:38   ` Catalin Marinas
2021-04-30 17:40   ` [kbuild-all] " Julia Lawall
2021-04-30 17:40     ` Julia Lawall
2021-04-30 17:56 ` Catalin Marinas
2021-04-30 17:56   ` Catalin Marinas

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=20210430114935.GB53304@C02TD0UTHF1T.local \
    --to=mark.rutland@arm.com \
    --cc=amit.kachhap@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=efremov@linux.com \
    --cc=julia.lawall@inria.fr \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@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.