[PATCH 04/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 to fix sparse warnings

2016-09-13 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/slicoss/slic.h | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 4c22863..b9595c4 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -560,6 +560,31 @@ static inline void slic_flush_write(struct adapter 
*adapter)
iowrite32(value, _base);\
 })
 
+#ifdef CONFIG_64BIT
+#define IOMEM_GET_FIELD64(base, member)
\
+({ \
+   char __iomem *_base = (char __iomem *)base; \
+   _base += offsetof(typeof(*base), member);   \
+   readq(_base);   \
+})
+#else
+#define IOMEM_GET_FIELD64(base, member)
\
+({ \
+   char __iomem *_base = (char __iomem *)base; \
+   u64 val;\
+   _base += offsetof(typeof(*base), member);   \
+   val = ((u64)ioread8(_base + 7)) << 56;  \
+   val += ((u64)ioread8(_base + 6)) << 48; \
+   val += ((u64)ioread8(_base + 5)) << 40; \
+   val += ((u64)ioread8(_base + 4)) << 32; \
+   val += ((u64)ioread8(_base + 3)) << 24; \
+   val += ((u64)ioread8(_base + 2)) << 16; \
+   val += ((u64)ioread8(_base + 1)) << 8;  \
+   val += ioread8(_base);  \
+   le64_to_cpu(val);   \
+})
+#endif
+
 #define UPDATE_STATS(largestat, newstat, oldstat)\
 {\
if ((newstat) < (oldstat))   \
-- 
2.7.4



[PATCH 04/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 to fix sparse warnings

2016-09-13 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/slicoss/slic.h | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 4c22863..b9595c4 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -560,6 +560,31 @@ static inline void slic_flush_write(struct adapter 
*adapter)
iowrite32(value, _base);\
 })
 
+#ifdef CONFIG_64BIT
+#define IOMEM_GET_FIELD64(base, member)
\
+({ \
+   char __iomem *_base = (char __iomem *)base; \
+   _base += offsetof(typeof(*base), member);   \
+   readq(_base);   \
+})
+#else
+#define IOMEM_GET_FIELD64(base, member)
\
+({ \
+   char __iomem *_base = (char __iomem *)base; \
+   u64 val;\
+   _base += offsetof(typeof(*base), member);   \
+   val = ((u64)ioread8(_base + 7)) << 56;  \
+   val += ((u64)ioread8(_base + 6)) << 48; \
+   val += ((u64)ioread8(_base + 5)) << 40; \
+   val += ((u64)ioread8(_base + 4)) << 32; \
+   val += ((u64)ioread8(_base + 3)) << 24; \
+   val += ((u64)ioread8(_base + 2)) << 16; \
+   val += ((u64)ioread8(_base + 1)) << 8;  \
+   val += ioread8(_base);  \
+   le64_to_cpu(val);   \
+})
+#endif
+
 #define UPDATE_STATS(largestat, newstat, oldstat)\
 {\
if ((newstat) < (oldstat))   \
-- 
2.7.4