* [PATCH v2] arm64: sysreg: fix sparse warnings
@ 2018-11-16 18:21 Sergey Matyukevich
2018-11-16 22:44 ` Luc Van Oostenryck
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Sergey Matyukevich @ 2018-11-16 18:21 UTC (permalink / raw)
To: linux-arm-kernel
Specify correct type for the constants to avoid
the following sparse complaints:
./arch/arm64/include/asm/sysreg.h:471:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
./arch/arm64/include/asm/sysreg.h:512:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
---
Changes v1 -> v2
- use proper type: UL rather than ULL
arch/arm64/include/asm/sysreg.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 0c909c4a932f..842fb9572661 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -468,7 +468,7 @@
SCTLR_ELx_SA | SCTLR_ELx_I | SCTLR_ELx_WXN | \
SCTLR_ELx_DSSBS | ENDIAN_CLEAR_EL2 | SCTLR_EL2_RES0)
-#if (SCTLR_EL2_SET ^ SCTLR_EL2_CLEAR) != 0xffffffffffffffff
+#if (SCTLR_EL2_SET ^ SCTLR_EL2_CLEAR) != 0xffffffffffffffffUL
#error "Inconsistent SCTLR_EL2 set/clear bits"
#endif
@@ -509,7 +509,7 @@
SCTLR_EL1_UMA | SCTLR_ELx_WXN | ENDIAN_CLEAR_EL1 |\
SCTLR_ELx_DSSBS | SCTLR_EL1_NTWI | SCTLR_EL1_RES0)
-#if (SCTLR_EL1_SET ^ SCTLR_EL1_CLEAR) != 0xffffffffffffffff
+#if (SCTLR_EL1_SET ^ SCTLR_EL1_CLEAR) != 0xffffffffffffffffUL
#error "Inconsistent SCTLR_EL1 set/clear bits"
#endif
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2] arm64: sysreg: fix sparse warnings
2018-11-16 18:21 [PATCH v2] arm64: sysreg: fix sparse warnings Sergey Matyukevich
@ 2018-11-16 22:44 ` Luc Van Oostenryck
2018-11-17 2:27 ` Will Deacon
2018-11-19 12:25 ` Catalin Marinas
2 siblings, 0 replies; 8+ messages in thread
From: Luc Van Oostenryck @ 2018-11-16 22:44 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 16, 2018 at 09:21:30PM +0300, Sergey Matyukevich wrote:
> Specify correct type for the constants to avoid
> the following sparse complaints:
>
> ./arch/arm64/include/asm/sysreg.h:471:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> ./arch/arm64/include/asm/sysreg.h:512:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
>
> Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
> ---
>
> Changes v1 -> v2
> - use proper type: UL rather than ULL
>
> arch/arm64/include/asm/sysreg.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
> index 0c909c4a932f..842fb9572661 100644
> --- a/arch/arm64/include/asm/sysreg.h
> +++ b/arch/arm64/include/asm/sysreg.h
> @@ -468,7 +468,7 @@
> SCTLR_ELx_SA | SCTLR_ELx_I | SCTLR_ELx_WXN | \
> SCTLR_ELx_DSSBS | ENDIAN_CLEAR_EL2 | SCTLR_EL2_RES0)
>
> -#if (SCTLR_EL2_SET ^ SCTLR_EL2_CLEAR) != 0xffffffffffffffff
> +#if (SCTLR_EL2_SET ^ SCTLR_EL2_CLEAR) != 0xffffffffffffffffUL
> #error "Inconsistent SCTLR_EL2 set/clear bits"
> #endif
>
> @@ -509,7 +509,7 @@
> SCTLR_EL1_UMA | SCTLR_ELx_WXN | ENDIAN_CLEAR_EL1 |\
> SCTLR_ELx_DSSBS | SCTLR_EL1_NTWI | SCTLR_EL1_RES0)
>
> -#if (SCTLR_EL1_SET ^ SCTLR_EL1_CLEAR) != 0xffffffffffffffff
> +#if (SCTLR_EL1_SET ^ SCTLR_EL1_CLEAR) != 0xffffffffffffffffUL
> #error "Inconsistent SCTLR_EL1 set/clear bits"
> #endif
Acked-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
I would also be fine with '!= ~0UL' which is, to me, slightly more
readeable (must not count the fs to know if it's all bits or not).
Regards,
-- Luc
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] arm64: sysreg: fix sparse warnings
2018-11-16 18:21 [PATCH v2] arm64: sysreg: fix sparse warnings Sergey Matyukevich
2018-11-16 22:44 ` Luc Van Oostenryck
@ 2018-11-17 2:27 ` Will Deacon
2018-11-17 2:55 ` Olof Johansson
2018-11-19 12:25 ` Catalin Marinas
2 siblings, 1 reply; 8+ messages in thread
From: Will Deacon @ 2018-11-17 2:27 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 16, 2018 at 09:21:30PM +0300, Sergey Matyukevich wrote:
> Specify correct type for the constants to avoid
> the following sparse complaints:
>
> ./arch/arm64/include/asm/sysreg.h:471:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> ./arch/arm64/include/asm/sysreg.h:512:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
>
> Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
> ---
I still think this is bogus, but the warning is clearly irritating so:
Acked-by: Will Deacon <will.deacon@arm.com>
Catalin, can you pick this up please?
Will
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] arm64: sysreg: fix sparse warnings
2018-11-17 2:27 ` Will Deacon
@ 2018-11-17 2:55 ` Olof Johansson
0 siblings, 0 replies; 8+ messages in thread
From: Olof Johansson @ 2018-11-17 2:55 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 16, 2018 at 6:28 PM Will Deacon <will.deacon@arm.com> wrote:
>
> On Fri, Nov 16, 2018 at 09:21:30PM +0300, Sergey Matyukevich wrote:
> > Specify correct type for the constants to avoid
> > the following sparse complaints:
> >
> > ./arch/arm64/include/asm/sysreg.h:471:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> > ./arch/arm64/include/asm/sysreg.h:512:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> >
> > Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
> > ---
>
> I still think this is bogus, but the warning is clearly irritating so:
>
> Acked-by: Will Deacon <will.deacon@arm.com>
>
> Catalin, can you pick this up please?
I missed this when searching and reposted a copy. So feel free to also:
Acked-by: Olof Johansson <olof@lixom.net>
-Olof
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] arm64: sysreg: fix sparse warnings
2018-11-16 18:21 [PATCH v2] arm64: sysreg: fix sparse warnings Sergey Matyukevich
2018-11-16 22:44 ` Luc Van Oostenryck
2018-11-17 2:27 ` Will Deacon
@ 2018-11-19 12:25 ` Catalin Marinas
2018-11-19 12:35 ` Will Deacon
2 siblings, 1 reply; 8+ messages in thread
From: Catalin Marinas @ 2018-11-19 12:25 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 16, 2018 at 09:21:30PM +0300, Sergey Matyukevich wrote:
> Specify correct type for the constants to avoid
> the following sparse complaints:
>
> ./arch/arm64/include/asm/sysreg.h:471:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> ./arch/arm64/include/asm/sysreg.h:512:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
>
> Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
I queued the patch for 4.20-rc4 and also changed the constant to ~0UL as
per Luc's suggestion. Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] arm64: sysreg: fix sparse warnings
2018-11-19 12:25 ` Catalin Marinas
@ 2018-11-19 12:35 ` Will Deacon
2018-11-19 12:57 ` Luc Van Oostenryck
0 siblings, 1 reply; 8+ messages in thread
From: Will Deacon @ 2018-11-19 12:35 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 19, 2018 at 12:25:11PM +0000, Catalin Marinas wrote:
> On Fri, Nov 16, 2018 at 09:21:30PM +0300, Sergey Matyukevich wrote:
> > Specify correct type for the constants to avoid
> > the following sparse complaints:
> >
> > ./arch/arm64/include/asm/sysreg.h:471:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> > ./arch/arm64/include/asm/sysreg.h:512:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> >
> > Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
>
> I queued the patch for 4.20-rc4 and also changed the constant to ~0UL as
> per Luc's suggestion. Thanks.
My vague worry with using ~0UL is that the preprocessor says:
It carries out all calculations in the widest integer type known to the
compiler; on most machines supported by GCC this is 64 bits.
which implies to me that if we ever got a 128-bit integer type, then this
would break.
Will
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] arm64: sysreg: fix sparse warnings
2018-11-19 12:35 ` Will Deacon
@ 2018-11-19 12:57 ` Luc Van Oostenryck
2018-11-19 14:08 ` Catalin Marinas
0 siblings, 1 reply; 8+ messages in thread
From: Luc Van Oostenryck @ 2018-11-19 12:57 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 19, 2018 at 12:35:32PM +0000, Will Deacon wrote:
> On Mon, Nov 19, 2018 at 12:25:11PM +0000, Catalin Marinas wrote:
> > On Fri, Nov 16, 2018 at 09:21:30PM +0300, Sergey Matyukevich wrote:
> > > Specify correct type for the constants to avoid
> > > the following sparse complaints:
> > >
> > > ./arch/arm64/include/asm/sysreg.h:471:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> > > ./arch/arm64/include/asm/sysreg.h:512:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> > >
> > > Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
> >
> > I queued the patch for 4.20-rc4 and also changed the constant to ~0UL as
> > per Luc's suggestion. Thanks.
>
> My vague worry with using ~0UL is that the preprocessor says:
>
> It carries out all calculations in the widest integer type known to the
> compiler; on most machines supported by GCC this is 64 bits.
>
> which implies to me that if we ever got a 128-bit integer type, then this
> would break.
True, indeed.
Note: since C99, the standard says:
(in the context of #if and #elif) "... all signed integer
types and all unsigned integer types act as if they have
the same representation as, respectively, the types intmax_t
and uintmax_t defined in the header <stdint.h>."
Which doesn't really change your concern.
Regards,
-- Luc
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] arm64: sysreg: fix sparse warnings
2018-11-19 12:57 ` Luc Van Oostenryck
@ 2018-11-19 14:08 ` Catalin Marinas
0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2018-11-19 14:08 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 19, 2018 at 01:57:20PM +0100, Luc Van Oostenryck wrote:
> On Mon, Nov 19, 2018 at 12:35:32PM +0000, Will Deacon wrote:
> > On Mon, Nov 19, 2018 at 12:25:11PM +0000, Catalin Marinas wrote:
> > > On Fri, Nov 16, 2018 at 09:21:30PM +0300, Sergey Matyukevich wrote:
> > > > Specify correct type for the constants to avoid
> > > > the following sparse complaints:
> > > >
> > > > ./arch/arm64/include/asm/sysreg.h:471:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> > > > ./arch/arm64/include/asm/sysreg.h:512:42: warning: constant 0xffffffffffffffff is so big it is unsigned long
> > > >
> > > > Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
> > >
> > > I queued the patch for 4.20-rc4 and also changed the constant to ~0UL as
> > > per Luc's suggestion. Thanks.
> >
> > My vague worry with using ~0UL is that the preprocessor says:
> >
> > It carries out all calculations in the widest integer type known to the
> > compiler; on most machines supported by GCC this is 64 bits.
> >
> > which implies to me that if we ever got a 128-bit integer type, then this
> > would break.
>
> True, indeed.
>
> Note: since C99, the standard says:
> (in the context of #if and #elif) "... all signed integer
> types and all unsigned integer types act as if they have
> the same representation as, respectively, the types intmax_t
> and uintmax_t defined in the header <stdint.h>."
> Which doesn't really change your concern.
OK, I'll stick to the original patch.
--
Catalin
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-11-19 14:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-16 18:21 [PATCH v2] arm64: sysreg: fix sparse warnings Sergey Matyukevich
2018-11-16 22:44 ` Luc Van Oostenryck
2018-11-17 2:27 ` Will Deacon
2018-11-17 2:55 ` Olof Johansson
2018-11-19 12:25 ` Catalin Marinas
2018-11-19 12:35 ` Will Deacon
2018-11-19 12:57 ` Luc Van Oostenryck
2018-11-19 14:08 ` Catalin Marinas
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.