linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] staging: slicoss: fix different address space sparse warnings
@ 2016-09-14  2:59 Peng Sun
  2016-09-14  2:59 ` [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix " Peng Sun
  0 siblings, 1 reply; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

base commit-id d221eb9f14f9

Peng Sun (10):
  staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix
    sparse warnings
  staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 to fix sparse
    warnings
  staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 to fix sparse
    warnings
  staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 to fix sparse
    warnings
  staging: slicoss: slicoss.c: fix different address space sparse
    warning
  staging: slicoss: slicoss.c: fix different address space sparse
    warning
  staging: slicoss: slicoss.c: fix different address space sparse
    warning
  staging: slicoss: slicoss.c: fix different address space sparse
    warning
  staging: slicoss: slicoss.c: fix different address space sparse
    warning
  staging: slicoss: slicoss.c: fix different address space sparse
    warning

 drivers/staging/slicoss/slic.h    | 46 ++++++++++++++++++++++
 drivers/staging/slicoss/slicoss.c | 82 +++++++++++++++++++++++----------------
 2 files changed, 95 insertions(+), 33 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
  2016-09-14  2:59 [PATCH 00/10] staging: slicoss: fix different address space sparse warnings Peng Sun
@ 2016-09-14  2:59 ` Peng Sun
  2016-09-14  2:59   ` [PATCH 02/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 " Peng Sun
                     ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 drivers/staging/slicoss/slic.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index fe1d2ce..7c23190 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_FIELDADDR(base, member)				\
+({									\
+	char __iomem *_base = (char __iomem *)base;			\
+	_base += offsetof(typeof(*base), member);			\
+	(void __iomem *)_base;						\
+})
+
 #define UPDATE_STATS(largestat, newstat, oldstat)                        \
 {                                                                        \
 	if ((newstat) < (oldstat))                                       \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 02/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 to fix sparse warnings
  2016-09-14  2:59 ` [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix " Peng Sun
@ 2016-09-14  2:59   ` Peng Sun
  2016-09-14  2:59     ` [PATCH 03/10] staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 " Peng Sun
  2016-09-16  7:52   ` [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings Greg KH
  2016-09-16  7:52   ` Greg KH
  2 siblings, 1 reply; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 drivers/staging/slicoss/slic.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 7c23190..ff71070 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -546,6 +546,13 @@ static inline void slic_flush_write(struct adapter *adapter)
 	(void __iomem *)_base;						\
 })
 
+#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))                                       \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 03/10] staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 to fix sparse warnings
  2016-09-14  2:59   ` [PATCH 02/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 " Peng Sun
@ 2016-09-14  2:59     ` Peng Sun
  2016-09-14  2:59       ` [PATCH 04/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 " Peng Sun
  0 siblings, 1 reply; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 drivers/staging/slicoss/slic.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index ff71070..4c22863 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);					\
+})
+
 #define UPDATE_STATS(largestat, newstat, oldstat)                        \
 {                                                                        \
 	if ((newstat) < (oldstat))                                       \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 04/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 to fix sparse warnings
  2016-09-14  2:59     ` [PATCH 03/10] staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 " Peng Sun
@ 2016-09-14  2:59       ` Peng Sun
  2016-09-14  2:59         ` [PATCH 05/10] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun
  0 siblings, 1 reply; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 05/10] staging: slicoss: slicoss.c: fix different address space sparse warning
  2016-09-14  2:59       ` [PATCH 04/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 " Peng Sun
@ 2016-09-14  2:59         ` Peng Sun
  2016-09-14  2:59           ` [PATCH 06/10] " Peng Sun
  0 siblings, 1 reply; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

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

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 06/10] staging: slicoss: slicoss.c: fix different address space sparse warning
  2016-09-14  2:59         ` [PATCH 05/10] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun
@ 2016-09-14  2:59           ` Peng Sun
  2016-09-14  2:59             ` [PATCH 07/10] " Peng Sun
  0 siblings, 1 reply; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 drivers/staging/slicoss/slicoss.c | 49 +++++++++++++++++++++++++--------------
 1 file changed, 32 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 929a0d5..03b01c5 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1004,8 +1004,9 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
 	switch (upr->upr_request) {
 	case SLIC_UPR_STATS: {
 		struct slic_shmemory *sm = &adapter->shmem;
-		struct slic_shmem_data *sm_data = sm->shmem_data;
-		struct slic_stats *stats = &sm_data->stats;
+		struct slic_shmem_data __iomem *sm_data = sm->shmem_data;
+		struct slic_stats __iomem *stats =
+					IOMEM_GET_FIELDADDR(sm_data, stats);
 		struct slic_stats *old = &adapter->inicstats_prev;
 		struct slicnet_stats *stst = &adapter->slic_stats;
 
@@ -1015,48 +1016,62 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
 			break;
 		}
 
-		UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs,
+		UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs,
+				IOMEM_GET_FIELD64(stats, xmit_tcp_segs),
 				old->xmit_tcp_segs);
 
-		UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes,
+		UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes,
+				IOMEM_GET_FIELD64(stats, xmit_tcp_bytes),
 				old->xmit_tcp_bytes);
 
-		UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs,
+		UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs,
+				IOMEM_GET_FIELD64(stats, rcv_tcp_segs),
 				old->rcv_tcp_segs);
 
-		UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes,
+		UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes,
+				IOMEM_GET_FIELD64(stats, rcv_tcp_bytes),
 				old->rcv_tcp_bytes);
 
-		UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes,
+		UPDATE_STATS_GB(stst->iface.xmt_bytes,
+				IOMEM_GET_FIELD64(stats, xmit_bytes),
 				old->xmit_bytes);
 
-		UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts,
+		UPDATE_STATS_GB(stst->iface.xmt_ucast,
+				IOMEM_GET_FIELD64(stats, xmit_unicasts),
 				old->xmit_unicasts);
 
-		UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes,
+		UPDATE_STATS_GB(stst->iface.rcv_bytes,
+				IOMEM_GET_FIELD64(stats, rcv_bytes),
 				old->rcv_bytes);
 
-		UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts,
+		UPDATE_STATS_GB(stst->iface.rcv_ucast,
+				IOMEM_GET_FIELD64(stats, rcv_unicasts),
 				old->rcv_unicasts);
 
-		UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions,
+		UPDATE_STATS_GB(stst->iface.xmt_errors,
+				IOMEM_GET_FIELD64(stats, xmit_collisions),
 				old->xmit_collisions);
 
 		UPDATE_STATS_GB(stst->iface.xmt_errors,
-				stats->xmit_excess_collisions,
+				IOMEM_GET_FIELD64(stats,
+						  xmit_excess_collisions),
 				old->xmit_excess_collisions);
 
-		UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error,
+		UPDATE_STATS_GB(stst->iface.xmt_errors,
+				IOMEM_GET_FIELD64(stats, xmit_other_error),
 				old->xmit_other_error);
 
-		UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error,
+		UPDATE_STATS_GB(stst->iface.rcv_errors,
+				IOMEM_GET_FIELD64(stats, rcv_other_error),
 				old->rcv_other_error);
 
-		UPDATE_STATS_GB(stst->iface.rcv_discards, stats->rcv_drops,
+		UPDATE_STATS_GB(stst->iface.rcv_discards,
+				IOMEM_GET_FIELD64(stats, rcv_drops),
 				old->rcv_drops);
 
-		if (stats->rcv_drops > old->rcv_drops)
-			adapter->rcv_drops += (stats->rcv_drops -
+		if (IOMEM_GET_FIELD64(stats, rcv_drops) > old->rcv_drops)
+			adapter->rcv_drops +=
+					(IOMEM_GET_FIELD64(stats, rcv_drops) -
 					       old->rcv_drops);
 		memcpy_fromio(old, stats, sizeof(*stats));
 		break;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 07/10] staging: slicoss: slicoss.c: fix different address space sparse warning
  2016-09-14  2:59           ` [PATCH 06/10] " Peng Sun
@ 2016-09-14  2:59             ` Peng Sun
  2016-09-14  2:59               ` [PATCH 08/10] " Peng Sun
  0 siblings, 1 reply; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 drivers/staging/slicoss/slicoss.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 03b01c5..2097d64 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1697,9 +1697,10 @@ static void slic_init_cleanup(struct adapter *adapter)
 
 	if (adapter->shmem.shmem_data) {
 		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;
 
-		pci_free_consistent(adapter->pcidev, sizeof(*sm_data), sm_data,
+		pci_free_consistent(adapter->pcidev, sizeof(*sm_data),
+				    (void __force *)sm_data,
 				    sm->isr_phaddr);
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/10] staging: slicoss: slicoss.c: fix different address space sparse warning
  2016-09-14  2:59             ` [PATCH 07/10] " Peng Sun
@ 2016-09-14  2:59               ` Peng Sun
  2016-09-14  2:59                 ` [PATCH 09/10] " Peng Sun
  0 siblings, 1 reply; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 drivers/staging/slicoss/slicoss.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 2097d64..a2d9c77 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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/10] staging: slicoss: slicoss.c: fix different address space sparse warning
  2016-09-14  2:59               ` [PATCH 08/10] " Peng Sun
@ 2016-09-14  2:59                 ` Peng Sun
  2016-09-14  2:59                   ` [PATCH 10/10] " Peng Sun
  0 siblings, 1 reply; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 drivers/staging/slicoss/slicoss.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index a2d9c77..6ecf71c 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2230,7 +2230,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags)
 	struct sliccard *card = adapter->card;
 	struct net_device *dev = adapter->netdev;
 	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;
 	int rc;
 
 	/* adapter should be down at this point */
@@ -2314,7 +2314,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags)
 	/*
 	 *    clear any pending events, then enable interrupts
 	 */
-	sm_data->isr = 0;
+	IOMEM_SET_FIELD32(0, sm_data, isr);
 	slic_write32(adapter, SLIC_REG_ISR, 0);
 	slic_write32(adapter, SLIC_REG_ICR, ICR_INT_ON);
 
@@ -2603,7 +2603,7 @@ static void slic_config_pci(struct pci_dev *pcidev)
 static int slic_card_init(struct sliccard *card, struct adapter *adapter)
 {
 	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;
 	struct slic_eeprom *peeprom;
 	struct oslic_eeprom *pOeeprom;
 	dma_addr_t phys_config;
@@ -2666,9 +2666,9 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
 		}
 
 		for (;;) {
-			if (sm_data->isr) {
-				if (sm_data->isr & ISR_UPC) {
-					sm_data->isr = 0;
+			if (IOMEM_GET_FIELD32(sm_data, isr)) {
+				if (IOMEM_GET_FIELD32(sm_data, isr) & ISR_UPC) {
+					IOMEM_SET_FIELD32(0, sm_data, isr);
 					slic_write64(adapter, SLIC_REG_ISP, 0,
 						     0);
 					slic_write32(adapter, SLIC_REG_ISR, 0);
@@ -2678,7 +2678,7 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
 					break;
 				}
 
-				sm_data->isr = 0;
+				IOMEM_SET_FIELD32(0, sm_data, isr);
 				slic_write32(adapter, SLIC_REG_ISR, 0);
 				slic_flush_write(adapter);
 			} else {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/10] staging: slicoss: slicoss.c: fix different address space sparse warning
  2016-09-14  2:59                 ` [PATCH 09/10] " Peng Sun
@ 2016-09-14  2:59                   ` Peng Sun
  0 siblings, 0 replies; 16+ messages in thread
From: Peng Sun @ 2016-09-14  2:59 UTC (permalink / raw)
  To: liodot, charrer, gregkh; +Cc: linux-kernel, Peng Sun

Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
 drivers/staging/slicoss/slicoss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 6ecf71c..e94dbd4 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2883,7 +2883,7 @@ static int slic_init_adapter(struct net_device *netdev,
 	if (!sm_data)
 		return -ENOMEM;
 
-	sm->shmem_data = sm_data;
+	sm->shmem_data = (struct slic_shmem_data __force __iomem *)sm_data;
 	sm->isr_phaddr = phaddr;
 	sm->lnkstatus_phaddr = phaddr + offsetof(struct slic_shmem_data,
 						 lnkstatus);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
  2016-09-14  2:59 ` [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix " Peng Sun
  2016-09-14  2:59   ` [PATCH 02/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 " Peng Sun
@ 2016-09-16  7:52   ` Greg KH
  2016-09-16  7:52   ` Greg KH
  2 siblings, 0 replies; 16+ messages in thread
From: Greg KH @ 2016-09-16  7:52 UTC (permalink / raw)
  To: Peng Sun; +Cc: liodot, charrer, linux-kernel

On Tue, Sep 13, 2016 at 07:59:50PM -0700, Peng Sun wrote:
> Signed-off-by: Peng Sun <sironhide0null@gmail.com>
> ---
>  drivers/staging/slicoss/slic.h | 7 +++++++
>  1 file changed, 7 insertions(+)

I can't take patches without any changelog text at all, sorry.

Please fix up this series and resend it.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
  2016-09-14  2:59 ` [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix " Peng Sun
  2016-09-14  2:59   ` [PATCH 02/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 " Peng Sun
  2016-09-16  7:52   ` [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings Greg KH
@ 2016-09-16  7:52   ` Greg KH
  2016-09-16 10:41     ` zerons
  2 siblings, 1 reply; 16+ messages in thread
From: Greg KH @ 2016-09-16  7:52 UTC (permalink / raw)
  To: Peng Sun; +Cc: liodot, charrer, linux-kernel

On Tue, Sep 13, 2016 at 07:59:50PM -0700, Peng Sun wrote:
> Signed-off-by: Peng Sun <sironhide0null@gmail.com>
> ---
>  drivers/staging/slicoss/slic.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
> index fe1d2ce..7c23190 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_FIELDADDR(base, member)				\
> +({									\
> +	char __iomem *_base = (char __iomem *)base;			\
> +	_base += offsetof(typeof(*base), member);			\
> +	(void __iomem *)_base;						\
> +})
> +
>  #define UPDATE_STATS(largestat, newstat, oldstat)                        \
>  {                                                                        \
>  	if ((newstat) < (oldstat))                                       \
> -- 
> 2.7.4

Wait, what does this patch on its own do?  Why create this macro?

greg k-h

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
  2016-09-16  7:52   ` Greg KH
@ 2016-09-16 10:41     ` zerons
  2016-09-16 12:57       ` Greg KH
  0 siblings, 1 reply; 16+ messages in thread
From: zerons @ 2016-09-16 10:41 UTC (permalink / raw)
  To: Greg KH; +Cc: liodot, charrer, linux-kernel

these marcos are used to get the value or address of a member of a `__iomem` structure.
GET_FIELDADDR is like &iomem_obj->field, and
GET_FIELD32 is iomem_obj->u32val, GET_FIELD64 is iomem_obj->u64val.

If patch the .c file directly, the source gets into a mess.


On 09/16/2016 03:52 PM, Greg KH wrote:
> On Tue, Sep 13, 2016 at 07:59:50PM -0700, Peng Sun wrote:
>> Signed-off-by: Peng Sun <sironhide0null@gmail.com>
>> ---
>>  drivers/staging/slicoss/slic.h | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
>> index fe1d2ce..7c23190 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_FIELDADDR(base, member)				\
>> +({									\
>> +	char __iomem *_base = (char __iomem *)base;			\
>> +	_base += offsetof(typeof(*base), member);			\
>> +	(void __iomem *)_base;						\
>> +})
>> +
>>  #define UPDATE_STATS(largestat, newstat, oldstat)                        \
>>  {                                                                        \
>>  	if ((newstat) < (oldstat))                                       \
>> -- 
>> 2.7.4
> 
> Wait, what does this patch on its own do?  Why create this macro?
> 
> greg k-h
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
  2016-09-16 10:41     ` zerons
@ 2016-09-16 12:57       ` Greg KH
  2016-09-16 13:54         ` zerons
  0 siblings, 1 reply; 16+ messages in thread
From: Greg KH @ 2016-09-16 12:57 UTC (permalink / raw)
  To: zerons; +Cc: liodot, charrer, linux-kernel


A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?


http://daringfireball.net/2007/07/on_top

On Fri, Sep 16, 2016 at 06:41:38PM +0800, zerons wrote:
> these marcos are used to get the value or address of a member of a `__iomem` structure.
> GET_FIELDADDR is like &iomem_obj->field, and
> GET_FIELD32 is iomem_obj->u32val, GET_FIELD64 is iomem_obj->u64val.
> 
> If patch the .c file directly, the source gets into a mess.

But add the macro, and then use it, in the same patch, so we can verify
that this macro really is doing what you think it is doing, and so that
it is used at the same time (no need to add a macro that no one uses...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
  2016-09-16 12:57       ` Greg KH
@ 2016-09-16 13:54         ` zerons
  0 siblings, 0 replies; 16+ messages in thread
From: zerons @ 2016-09-16 13:54 UTC (permalink / raw)
  To: Greg KH; +Cc: liodot, charrer, linux-kernel



On 09/16/2016 08:57 PM, Greg KH wrote:
> 
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?
> 
> A: No.
> Q: Should I include quotations after my reply?
> 
> 
> http://daringfireball.net/2007/07/on_top
> 
> On Fri, Sep 16, 2016 at 06:41:38PM +0800, zerons wrote:
>> these marcos are used to get the value or address of a member of a `__iomem` structure.
>> GET_FIELDADDR is like &iomem_obj->field, and
>> GET_FIELD32 is iomem_obj->u32val, GET_FIELD64 is iomem_obj->u64val.
>>
>> If patch the .c file directly, the source gets into a mess.
> 
> But add the macro, and then use it, in the same patch, so we can verify
> that this macro really is doing what you think it is doing, and so that
> it is used at the same time (no need to add a macro that no one uses...
> 
> thanks,
> 
> greg k-h
> 

Again, sorry about the `top-posting`. I am still not familiar with these
things, thanks for reminding me, I will follow the rules and try my best
not to waste your time.

Ok, I will add the macro and use it to fix the warning in the same patch,
and resend the patches.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-09-16 13:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14  2:59 [PATCH 00/10] staging: slicoss: fix different address space sparse warnings Peng Sun
2016-09-14  2:59 ` [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix " Peng Sun
2016-09-14  2:59   ` [PATCH 02/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 " Peng Sun
2016-09-14  2:59     ` [PATCH 03/10] staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 " Peng Sun
2016-09-14  2:59       ` [PATCH 04/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 " Peng Sun
2016-09-14  2:59         ` [PATCH 05/10] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun
2016-09-14  2:59           ` [PATCH 06/10] " Peng Sun
2016-09-14  2:59             ` [PATCH 07/10] " Peng Sun
2016-09-14  2:59               ` [PATCH 08/10] " Peng Sun
2016-09-14  2:59                 ` [PATCH 09/10] " Peng Sun
2016-09-14  2:59                   ` [PATCH 10/10] " Peng Sun
2016-09-16  7:52   ` [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings Greg KH
2016-09-16  7:52   ` Greg KH
2016-09-16 10:41     ` zerons
2016-09-16 12:57       ` Greg KH
2016-09-16 13:54         ` zerons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).