[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230816143912.34540-6-louis.peens@corigine.com>
Date: Wed, 16 Aug 2023 16:39:04 +0200
From: Louis Peens <louis.peens@...igine.com>
To: David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: Simon Horman <simon.horman@...igine.com>,
Yinjun Zhang <yinjun.zhang@...igine.com>,
Tianyu Yuan <tianyu.yuan@...igine.com>,
netdev@...r.kernel.org,
oss-drivers@...igine.com
Subject: [PATCH net-next v2 05/13] io-64-nonatomic: truncate bits explicitly to avoid warning
From: Yinjun Zhang <yinjun.zhang@...igine.com>
Sparse complains when passing constant value to these nonatomic io
write functions:
include/linux/io-64-nonatomic-hi-lo.h:22:16: sparse: sparse: cast truncates bits from constant value
Reported-by: kernel test robot <lkp@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307300422.oPy5E1hB-lkp@intel.com/
Signed-off-by: Yinjun Zhang <yinjun.zhang@...igine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@...igine.com>
Acked-by: Simon Horman <simon.horman@...igine.com>
Signed-off-by: Louis Peens <louis.peens@...igine.com>
---
include/linux/io-64-nonatomic-hi-lo.h | 8 ++++----
include/linux/io-64-nonatomic-lo-hi.h | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/io-64-nonatomic-hi-lo.h b/include/linux/io-64-nonatomic-hi-lo.h
index f32522bb3aa5..60bb802d4f23 100644
--- a/include/linux/io-64-nonatomic-hi-lo.h
+++ b/include/linux/io-64-nonatomic-hi-lo.h
@@ -19,7 +19,7 @@ static inline __u64 hi_lo_readq(const volatile void __iomem *addr)
static inline void hi_lo_writeq(__u64 val, volatile void __iomem *addr)
{
writel(val >> 32, addr + 4);
- writel(val, addr);
+ writel(val & U32_MAX, addr);
}
static inline __u64 hi_lo_readq_relaxed(const volatile void __iomem *addr)
@@ -36,7 +36,7 @@ static inline __u64 hi_lo_readq_relaxed(const volatile void __iomem *addr)
static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr)
{
writel_relaxed(val >> 32, addr + 4);
- writel_relaxed(val, addr);
+ writel_relaxed(val & U32_MAX, addr);
}
#ifndef readq
@@ -73,7 +73,7 @@ static inline u64 ioread64_hi_lo(const void __iomem *addr)
static inline void iowrite64_hi_lo(u64 val, void __iomem *addr)
{
iowrite32(val >> 32, addr + sizeof(u32));
- iowrite32(val, addr);
+ iowrite32(val & U32_MAX, addr);
}
#endif
@@ -95,7 +95,7 @@ static inline u64 ioread64be_hi_lo(const void __iomem *addr)
static inline void iowrite64be_hi_lo(u64 val, void __iomem *addr)
{
iowrite32be(val >> 32, addr);
- iowrite32be(val, addr + sizeof(u32));
+ iowrite32be(val & U32_MAX, addr + sizeof(u32));
}
#endif
diff --git a/include/linux/io-64-nonatomic-lo-hi.h b/include/linux/io-64-nonatomic-lo-hi.h
index 448a21435dba..b73acd377507 100644
--- a/include/linux/io-64-nonatomic-lo-hi.h
+++ b/include/linux/io-64-nonatomic-lo-hi.h
@@ -18,7 +18,7 @@ static inline __u64 lo_hi_readq(const volatile void __iomem *addr)
static inline void lo_hi_writeq(__u64 val, volatile void __iomem *addr)
{
- writel(val, addr);
+ writel(val & U32_MAX, addr);
writel(val >> 32, addr + 4);
}
@@ -35,7 +35,7 @@ static inline __u64 lo_hi_readq_relaxed(const volatile void __iomem *addr)
static inline void lo_hi_writeq_relaxed(__u64 val, volatile void __iomem *addr)
{
- writel_relaxed(val, addr);
+ writel_relaxed(val & U32_MAX, addr);
writel_relaxed(val >> 32, addr + 4);
}
@@ -72,7 +72,7 @@ static inline u64 ioread64_lo_hi(const void __iomem *addr)
#define iowrite64_lo_hi iowrite64_lo_hi
static inline void iowrite64_lo_hi(u64 val, void __iomem *addr)
{
- iowrite32(val, addr);
+ iowrite32(val & U32_MAX, addr);
iowrite32(val >> 32, addr + sizeof(u32));
}
#endif
@@ -94,7 +94,7 @@ static inline u64 ioread64be_lo_hi(const void __iomem *addr)
#define iowrite64be_lo_hi iowrite64be_lo_hi
static inline void iowrite64be_lo_hi(u64 val, void __iomem *addr)
{
- iowrite32be(val, addr + sizeof(u32));
+ iowrite32be(val & U32_MAX, addr + sizeof(u32));
iowrite32be(val >> 32, addr);
}
#endif
--
2.34.1
Powered by blists - more mailing lists