Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1485461

[PATCH 1/7] staging: slicoss: slicoss.c: fix different address space sparse warning

From Peng Sun <sironhide0null@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 1/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Date 2016-09-17 04:10 +0200
Message-ID <sideN-4J0-7@gated-at.bofh.it> (permalink)
References <sideN-4J0-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


add IOMEM_GET_FIELD32 to get u32 value of a member of a __iomem structure;

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 drivers/staging/slicoss/slic.h    | 7 +++++++
 drivers/staging/slicoss/slicoss.c | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index fe1d2ce..022e7f6 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -539,6 +539,13 @@ static inline void slic_flush_write(struct adapter *adapter)
 	ioread32(adapter->regs + SLIC_REG_HOSTID);
 }
 
+#define IOMEM_GET_FIELD32(base, member)					\
+({									\
+	char __iomem *_base = (char __iomem *)base;			\
+	_base += offsetof(typeof(*base), member);			\
+	ioread32(_base);						\
+})
+
 #define UPDATE_STATS(largestat, newstat, oldstat)                        \
 {                                                                        \
 	if ((newstat) < (oldstat))                                       \
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 21280a3..929a0d5 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -924,8 +924,8 @@ err_unlock_irq:
 static void slic_link_upr_complete(struct adapter *adapter, u32 isr)
 {
 	struct slic_shmemory *sm = &adapter->shmem;
-	struct slic_shmem_data *sm_data = sm->shmem_data;
-	u32 lst = sm_data->lnkstatus;
+	struct slic_shmem_data __iomem *sm_data = sm->shmem_data;
+	u32 lst = IOMEM_GET_FIELD32(sm_data, lnkstatus);
 	uint linkup;
 	unsigned char linkspeed;
 	unsigned char linkduplex;
-- 
2.7.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 1/7] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun <sironhide0null@gmail.com> - 2016-09-17 04:10 +0200

csiph-web