[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1474077952-9265-5-git-send-email-sironhide0null@gmail.com>
Date: Fri, 16 Sep 2016 19:05:49 -0700
From: Peng Sun <sironhide0null@...il.com>
To: liodot@...il.com, charrer@...critech.com,
gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, Peng Sun <sironhide0null@...il.com>
Subject: [PATCH 4/7] staging: slicoss: slicoss.c: fix different address space sparse warning
add IOMEM_SET_FIELD32 to set u32 value of a member of a __iomem structure;
Signed-off-by: Peng Sun <sironhide0null@...il.com>
---
drivers/staging/slicoss/slic.h | 7 +++++++
drivers/staging/slicoss/slicoss.c | 8 ++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index fec9ec5..b9595c4 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -553,6 +553,13 @@ static inline void slic_flush_write(struct adapter *adapter)
ioread32(_base); \
})
+#define IOMEM_SET_FIELD32(value, base, member) \
+({ \
+ char __iomem *_base = (char __iomem *)base; \
+ _base += offsetof(typeof(*base), member); \
+ iowrite32(value, _base); \
+})
+
#ifdef CONFIG_64BIT
#define IOMEM_GET_FIELD64(base, member) \
({ \
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 2128963..c92b8c5 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2087,15 +2087,15 @@ static irqreturn_t slic_interrupt(int irq, void *dev_id)
struct net_device *dev = dev_id;
struct adapter *adapter = netdev_priv(dev);
struct slic_shmemory *sm = &adapter->shmem;
- struct slic_shmem_data *sm_data = sm->shmem_data;
+ struct slic_shmem_data __iomem *sm_data = sm->shmem_data;
u32 isr;
- if (sm_data->isr) {
+ if (IOMEM_GET_FIELD32(sm_data, isr)) {
slic_write32(adapter, SLIC_REG_ICR, ICR_INT_MASK);
slic_flush_write(adapter);
- isr = sm_data->isr;
- sm_data->isr = 0;
+ isr = IOMEM_GET_FIELD32(sm_data, isr);
+ IOMEM_SET_FIELD32(0, sm_data, isr);
adapter->num_isrs++;
switch (adapter->card->state) {
case CARD_UP:
--
2.7.4
Powered by blists - more mailing lists