* [PATCH] arm64: cpufeatures: use min and max
@ 2021-04-29 20:50 ` Julia Lawall
0 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2021-04-29 20:50 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]
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>
---
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();
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] arm64: cpufeatures: use min and max
2021-04-29 20:50 ` Julia Lawall
@ 2021-04-30 11:49 ` Mark Rutland
-1 siblings, 0 replies; 10+ messages in thread
From: Mark Rutland @ 2021-04-30 11:49 UTC (permalink / raw)
To: Julia Lawall
Cc: Catalin Marinas, Will Deacon, Suzuki K Poulose,
Anshuman Khandual, Marc Zyngier, Amit Daniel Kachhap,
Denis Efremov, kbuild-all, linux-arm-kernel
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] arm64: cpufeatures: use min and max
@ 2021-04-30 11:49 ` Mark Rutland
0 siblings, 0 replies; 10+ messages in thread
From: Mark Rutland @ 2021-04-30 11:49 UTC (permalink / raw)
To: kbuild-all
[-- 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();
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] arm64: cpufeatures: use min and max
2021-04-29 20:50 ` Julia Lawall
@ 2021-04-30 17:38 ` Catalin Marinas
-1 siblings, 0 replies; 10+ messages in thread
From: Catalin Marinas @ 2021-04-30 17:38 UTC (permalink / raw)
To: Julia Lawall
Cc: Will Deacon, Suzuki K Poulose, Anshuman Khandual, Marc Zyngier,
Mark Rutland, Amit Daniel Kachhap, Denis Efremov, kbuild-all,
linux-arm-kernel
Hi Julia,
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")
What's with this Fixes tag? I can't find it anywhere and I don't think
it warrants such a tag anyway, it's not a bug.
I'll apply it without the tag and include minmax.h as per Mark's
comment.
Thanks.
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] arm64: cpufeatures: use min and max
@ 2021-04-30 17:38 ` Catalin Marinas
0 siblings, 0 replies; 10+ messages in thread
From: Catalin Marinas @ 2021-04-30 17:38 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 523 bytes --]
Hi Julia,
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")
What's with this Fixes tag? I can't find it anywhere and I don't think
it warrants such a tag anyway, it's not a bug.
I'll apply it without the tag and include minmax.h as per Mark's
comment.
Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [kbuild-all] Re: [PATCH] arm64: cpufeatures: use min and max
2021-04-30 17:38 ` Catalin Marinas
@ 2021-04-30 17:40 ` Julia Lawall
-1 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2021-04-30 17:40 UTC (permalink / raw)
To: Catalin Marinas
Cc: Will Deacon, Suzuki K Poulose, Anshuman Khandual, Marc Zyngier,
Mark Rutland, Amit Daniel Kachhap, Denis Efremov, kbuild-all,
linux-arm-kernel
On Fri, 30 Apr 2021, Catalin Marinas wrote:
> Hi Julia,
>
> 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")
>
> What's with this Fixes tag? I can't find it anywhere and I don't think
> it warrants such a tag anyway, it's not a bug.
>
> I'll apply it without the tag and include minmax.h as per Mark's
> comment.
Oops, sorry about that. It's something that 0-day adds, but I think it is
always incorrect for new semantic patches. Please remove it.
thanks,
julia
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] arm64: cpufeatures: use min and max
@ 2021-04-30 17:40 ` Julia Lawall
0 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2021-04-30 17:40 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 732 bytes --]
On Fri, 30 Apr 2021, Catalin Marinas wrote:
> Hi Julia,
>
> 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")
>
> What's with this Fixes tag? I can't find it anywhere and I don't think
> it warrants such a tag anyway, it's not a bug.
>
> I'll apply it without the tag and include minmax.h as per Mark's
> comment.
Oops, sorry about that. It's something that 0-day adds, but I think it is
always incorrect for new semantic patches. Please remove it.
thanks,
julia
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] arm64: cpufeatures: use min and max
2021-04-29 20:50 ` Julia Lawall
@ 2021-04-30 17:56 ` Catalin Marinas
-1 siblings, 0 replies; 10+ messages in thread
From: Catalin Marinas @ 2021-04-30 17:56 UTC (permalink / raw)
To: Amit Daniel Kachhap, Mark Rutland, Suzuki K Poulose,
Marc Zyngier, Anshuman Khandual, Julia Lawall, Will Deacon
Cc: Denis Efremov, linux-arm-kernel, kbuild-all
On Thu, 29 Apr 2021 22:50:46 +0200 (CEST), Julia Lawall wrote:
> Use min and max to make the effect more clear.
>
> Generated by: scripts/coccinelle/misc/minmax.cocci
Applied to arm64 (for-next/core), thanks!
[1/1] arm64: cpufeatures: use min and max
https://git.kernel.org/arm64/c/f6334b1798c1
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread