linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] uapi: add missing const qualifier to cast in some byteorder functions
@ 2024-04-10 20:54 arlr
  0 siblings, 0 replies; only message in thread
From: arlr @ 2024-04-10 20:54 UTC (permalink / raw)
  To: linux-kernel, linux-api

Add missing const qualifiers to cast in __{le,be}{16,32,64}_to_cpup.

Signed-off-by: Carl Rosdahl <carl.rosdahl05@gmail.com>
---
reduced testcase (on exported headers):
$ cc -c -o /dev/null -Wcast-qual -xc usr/include/linux/byteorder/big_endian.h
$ cc -c -o /dev/null -Wcast-qual -xc usr/include/linux/byteorder/little_endian.h

diff --git a/include/uapi/linux/byteorder/big_endian.h
b/include/uapi/linux/byteorder/big_endian.h
index 80aa5c41a763..e59ec4f8bd92 100644
--- a/include/uapi/linux/byteorder/big_endian.h
+++ b/include/uapi/linux/byteorder/big_endian.h
@@ -48,7 +48,7 @@ static __always_inline __le64 __cpu_to_le64p(const __u64 *p)
 }
 static __always_inline __u64 __le64_to_cpup(const __le64 *p)
 {
-    return __swab64p((__u64 *)p);
+    return __swab64p((const __u64 *)p);
 }
 static __always_inline __le32 __cpu_to_le32p(const __u32 *p)
 {
@@ -56,7 +56,7 @@ static __always_inline __le32 __cpu_to_le32p(const __u32 *p)
 }
 static __always_inline __u32 __le32_to_cpup(const __le32 *p)
 {
-    return __swab32p((__u32 *)p);
+    return __swab32p((const __u32 *)p);
 }
 static __always_inline __le16 __cpu_to_le16p(const __u16 *p)
 {
@@ -64,7 +64,7 @@ static __always_inline __le16 __cpu_to_le16p(const __u16 *p)
 }
 static __always_inline __u16 __le16_to_cpup(const __le16 *p)
 {
-    return __swab16p((__u16 *)p);
+    return __swab16p((const __u16 *)p);
 }
 static __always_inline __be64 __cpu_to_be64p(const __u64 *p)
 {
diff --git a/include/uapi/linux/byteorder/little_endian.h
b/include/uapi/linux/byteorder/little_endian.h
index cd98982e7523..65204e600fbf 100644
--- a/include/uapi/linux/byteorder/little_endian.h
+++ b/include/uapi/linux/byteorder/little_endian.h
@@ -72,7 +72,7 @@ static __always_inline __be64 __cpu_to_be64p(const __u64 *p)
 }
 static __always_inline __u64 __be64_to_cpup(const __be64 *p)
 {
-    return __swab64p((__u64 *)p);
+    return __swab64p((const __u64 *)p);
 }
 static __always_inline __be32 __cpu_to_be32p(const __u32 *p)
 {
@@ -80,7 +80,7 @@ static __always_inline __be32 __cpu_to_be32p(const __u32 *p)
 }
 static __always_inline __u32 __be32_to_cpup(const __be32 *p)
 {
-    return __swab32p((__u32 *)p);
+    return __swab32p((const __u32 *)p);
 }
 static __always_inline __be16 __cpu_to_be16p(const __u16 *p)
 {
@@ -88,7 +88,7 @@ static __always_inline __be16 __cpu_to_be16p(const __u16 *p)
 }
 static __always_inline __u16 __be16_to_cpup(const __be16 *p)
 {
-    return __swab16p((__u16 *)p);
+    return __swab16p((const __u16 *)p);
 }
 #define __cpu_to_le64s(x) do { (void)(x); } while (0)
 #define __le64_to_cpus(x) do { (void)(x); } while (0)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-10 18:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 20:54 [PATCH] uapi: add missing const qualifier to cast in some byteorder functions arlr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).