public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peng Sun <sironhide0null@gmail.com>
To: liodot@gmail.com, charrer@alacritech.com, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, Peng Sun <sironhide0null@gmail.com>
Subject: [PATCH 4/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Date: Fri, 16 Sep 2016 19:05:49 -0700	[thread overview]
Message-ID: <1474077952-9265-5-git-send-email-sironhide0null@gmail.com> (raw)
In-Reply-To: <1474077952-9265-1-git-send-email-sironhide0null@gmail.com>

add IOMEM_SET_FIELD32 to set 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 | 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

  parent reply	other threads:[~2016-09-17  2:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-17  2:05 [PATCH 0/7] staging: slicoss: fix different address space sparse warnings Peng Sun
2016-09-17  2:05 ` [PATCH 1/7] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun
2016-09-17  2:05 ` [PATCH 2/7] " Peng Sun
2016-09-17  2:05 ` [PATCH 3/7] " Peng Sun
2016-09-17  2:05 ` Peng Sun [this message]
2016-09-17  2:05 ` [PATCH 5/7] " Peng Sun
2016-09-17  2:05 ` [PATCH 6/7] " Peng Sun
2016-09-17  2:05 ` [PATCH 7/7] " Peng Sun
2016-09-17  8:30   ` Greg KH
2016-09-17  8:30 ` [PATCH 0/7] staging: slicoss: fix different address space sparse warnings Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474077952-9265-5-git-send-email-sironhide0null@gmail.com \
    --to=sironhide0null@gmail.com \
    --cc=charrer@alacritech.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liodot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox