[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAGfdVaw_TU__+XJQyOSHncGFziE206c7=UVbfjvPHnq14xOVjg@mail.gmail.com>
Date: Wed, 10 Apr 2024 22:54:18 +0200
From: arlr <carl.rosdahl05@...il.com>
To: linux-kernel@...r.kernel.org, linux-api@...r.kernel.org
Subject: [PATCH] uapi: add missing const qualifier to cast in some byteorder functions
Add missing const qualifiers to cast in __{le,be}{16,32,64}_to_cpup.
Signed-off-by: Carl Rosdahl <carl.rosdahl05@...il.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)
Powered by blists - more mailing lists