All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] linux/types.h: Tidy __bitwise, add __CHECKER__ hints
@ 2022-03-10 22:09 Bjorn Helgaas
  2022-03-10 22:09 ` [PATCH 1/2] linux/types.h: Remove unnecessary __bitwise__ Bjorn Helgaas
  2022-03-10 22:09 ` [PATCH 2/2] Documentation/sparse: Add hints about __CHECKER__ Bjorn Helgaas
  0 siblings, 2 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2022-03-10 22:09 UTC (permalink / raw)
  To: Andrew Morton, Jonathan Corbet
  Cc: Nathan Chancellor, Nick Desaulniers, Michael S . Tsirkin, llvm,
	linux-doc, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

- Tidy up __bitwise__, which is unused except in the __bitwise definition

- Add hints about what __CHECKER__ means

Bjorn Helgaas (2):
  linux/types.h: Remove unnecessary __bitwise__
  Documentation/sparse: Add hints about __CHECKER__

 Documentation/dev-tools/sparse.rst | 2 ++
 include/linux/compiler_types.h     | 1 +
 include/uapi/linux/types.h         | 6 +++---
 3 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] linux/types.h: Remove unnecessary __bitwise__
  2022-03-10 22:09 [PATCH 0/2] linux/types.h: Tidy __bitwise, add __CHECKER__ hints Bjorn Helgaas
@ 2022-03-10 22:09 ` Bjorn Helgaas
  2022-03-11  1:52   ` Andrew Morton
  2022-03-10 22:09 ` [PATCH 2/2] Documentation/sparse: Add hints about __CHECKER__ Bjorn Helgaas
  1 sibling, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2022-03-10 22:09 UTC (permalink / raw)
  To: Andrew Morton, Jonathan Corbet
  Cc: Nathan Chancellor, Nick Desaulniers, Michael S . Tsirkin, llvm,
	linux-doc, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

There are no users of "__bitwise__" except the definition of "__bitwise".
Remove __bitwise__ and define __bitwise directly.

This is a follow-up to 05de97003c77 ("linux/types.h: enable endian checks
for all sparse builds").

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
---
 include/uapi/linux/types.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h
index f6d2f83cbe29..71696f424ac8 100644
--- a/include/uapi/linux/types.h
+++ b/include/uapi/linux/types.h
@@ -20,11 +20,10 @@
  */
 
 #ifdef __CHECKER__
-#define __bitwise__ __attribute__((bitwise))
+#define __bitwise	__attribute__((bitwise))
 #else
-#define __bitwise__
+#define __bitwise
 #endif
-#define __bitwise __bitwise__
 
 typedef __u16 __bitwise __le16;
 typedef __u16 __bitwise __be16;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Documentation/sparse: Add hints about __CHECKER__
  2022-03-10 22:09 [PATCH 0/2] linux/types.h: Tidy __bitwise, add __CHECKER__ hints Bjorn Helgaas
  2022-03-10 22:09 ` [PATCH 1/2] linux/types.h: Remove unnecessary __bitwise__ Bjorn Helgaas
@ 2022-03-10 22:09 ` Bjorn Helgaas
  1 sibling, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2022-03-10 22:09 UTC (permalink / raw)
  To: Andrew Morton, Jonathan Corbet
  Cc: Nathan Chancellor, Nick Desaulniers, Michael S . Tsirkin, llvm,
	linux-doc, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Several attributes depend on __CHECKER__, but previously there was no clue
in the tree about when __CHECKER__ might be defined.  Add hints at the most
common places (__kernel, __user, __iomem, __bitwise) and in the sparse
documentation.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 Documentation/dev-tools/sparse.rst | 2 ++
 include/linux/compiler_types.h     | 1 +
 include/uapi/linux/types.h         | 1 +
 3 files changed, 4 insertions(+)

diff --git a/Documentation/dev-tools/sparse.rst b/Documentation/dev-tools/sparse.rst
index 02102be7ff49..dc791c8d84d1 100644
--- a/Documentation/dev-tools/sparse.rst
+++ b/Documentation/dev-tools/sparse.rst
@@ -100,3 +100,5 @@ have already built it.
 
 The optional make variable CF can be used to pass arguments to sparse.  The
 build system passes -Wbitwise to sparse automatically.
+
+Note that sparse defines the __CHECKER__ preprocessor symbol.
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 3c1795fdb568..4b3915ce38a4 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -4,6 +4,7 @@
 
 #ifndef __ASSEMBLY__
 
+/* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */
 #ifdef __CHECKER__
 /* address spaces */
 # define __kernel	__attribute__((address_space(0)))
diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h
index 71696f424ac8..c4dc597f3dcf 100644
--- a/include/uapi/linux/types.h
+++ b/include/uapi/linux/types.h
@@ -19,6 +19,7 @@
  * any application/library that wants linux/types.h.
  */
 
+/* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */
 #ifdef __CHECKER__
 #define __bitwise	__attribute__((bitwise))
 #else
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] linux/types.h: Remove unnecessary __bitwise__
  2022-03-10 22:09 ` [PATCH 1/2] linux/types.h: Remove unnecessary __bitwise__ Bjorn Helgaas
@ 2022-03-11  1:52   ` Andrew Morton
  2022-03-11 16:18     ` Bjorn Helgaas
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2022-03-11  1:52 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jonathan Corbet, Nathan Chancellor, Nick Desaulniers,
	Michael S . Tsirkin, llvm, linux-doc, linux-kernel,
	Bjorn Helgaas

On Thu, 10 Mar 2022 16:09:26 -0600 Bjorn Helgaas <helgaas@kernel.org> wrote:

> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> There are no users of "__bitwise__" except the definition of "__bitwise".
> Remove __bitwise__ and define __bitwise directly.
> 
> This is a follow-up to 05de97003c77 ("linux/types.h: enable endian checks
> for all sparse builds").
> 

Can we change the copy-pasted code in tools/include/linux/types.h while
we're there?


--- a/tools/include/linux/types.h~linux-typesh-remove-unnecessary-__bitwise__-fix
+++ a/tools/include/linux/types.h
@@ -43,11 +43,10 @@ typedef __u8  u8;
 typedef __s8  s8;
 
 #ifdef __CHECKER__
-#define __bitwise__ __attribute__((bitwise))
+#define __bitwise	__attribute__((bitwise))
 #else
-#define __bitwise__
+#define __bitwise
 #endif
-#define __bitwise __bitwise__
 
 #define __force
 #define __user
_


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] linux/types.h: Remove unnecessary __bitwise__
  2022-03-11  1:52   ` Andrew Morton
@ 2022-03-11 16:18     ` Bjorn Helgaas
  0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2022-03-11 16:18 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Jonathan Corbet, Nathan Chancellor, Nick Desaulniers,
	Michael S . Tsirkin, llvm, linux-doc, linux-kernel,
	Bjorn Helgaas

On Thu, Mar 10, 2022 at 05:52:16PM -0800, Andrew Morton wrote:
> On Thu, 10 Mar 2022 16:09:26 -0600 Bjorn Helgaas <helgaas@kernel.org> wrote:
> 
> > From: Bjorn Helgaas <bhelgaas@google.com>
> > 
> > There are no users of "__bitwise__" except the definition of "__bitwise".
> > Remove __bitwise__ and define __bitwise directly.
> > 
> > This is a follow-up to 05de97003c77 ("linux/types.h: enable endian checks
> > for all sparse builds").
> > 
> 
> Can we change the copy-pasted code in tools/include/linux/types.h while
> we're there?

Oh, you bet!  Thanks for pointing that out!

> --- a/tools/include/linux/types.h~linux-typesh-remove-unnecessary-__bitwise__-fix
> +++ a/tools/include/linux/types.h
> @@ -43,11 +43,10 @@ typedef __u8  u8;
>  typedef __s8  s8;
>  
>  #ifdef __CHECKER__
> -#define __bitwise__ __attribute__((bitwise))
> +#define __bitwise	__attribute__((bitwise))
>  #else
> -#define __bitwise__
> +#define __bitwise
>  #endif
> -#define __bitwise __bitwise__
>  
>  #define __force
>  #define __user
> _
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-11 16:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 22:09 [PATCH 0/2] linux/types.h: Tidy __bitwise, add __CHECKER__ hints Bjorn Helgaas
2022-03-10 22:09 ` [PATCH 1/2] linux/types.h: Remove unnecessary __bitwise__ Bjorn Helgaas
2022-03-11  1:52   ` Andrew Morton
2022-03-11 16:18     ` Bjorn Helgaas
2022-03-10 22:09 ` [PATCH 2/2] Documentation/sparse: Add hints about __CHECKER__ Bjorn Helgaas

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.