Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1485466 > unrolled thread
| Started by | Peng Sun <sironhide0null@gmail.com> |
|---|---|
| First post | 2016-09-17 04:10 +0200 |
| Last post | 2016-09-17 10:40 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/7] staging: slicoss: fix different address space sparse warnings Peng Sun <sironhide0null@gmail.com> - 2016-09-17 04:10 +0200
[PATCH 2/7] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun <sironhide0null@gmail.com> - 2016-09-17 04:10 +0200
[PATCH 5/7] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun <sironhide0null@gmail.com> - 2016-09-17 04:10 +0200
[PATCH 6/7] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun <sironhide0null@gmail.com> - 2016-09-17 04:10 +0200
Re: [PATCH 0/7] staging: slicoss: fix different address space sparse warnings Greg KH <gregkh@linuxfoundation.org> - 2016-09-17 10:40 +0200
| From | Peng Sun <sironhide0null@gmail.com> |
|---|---|
| Date | 2016-09-17 04:10 +0200 |
| Subject | [PATCH 0/7] staging: slicoss: fix different address space sparse warnings |
| Message-ID | <sideN-4J0-3@gated-at.bofh.it> |
commit-id d221eb9f14f9, "Add linux-next specific files for 20160909"
add several macros to fix these warnings
Peng Sun (7):
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
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
[toc] | [next] | [standalone]
| From | Peng Sun <sironhide0null@gmail.com> |
|---|---|
| Date | 2016-09-17 04:10 +0200 |
| Subject | [PATCH 2/7] staging: slicoss: slicoss.c: fix different address space sparse warning |
| Message-ID | <sideN-4J0-15@gated-at.bofh.it> |
| In reply to | #1485466 |
add IOMEM_GET_FIELDADDR to get address of a member of a __iomem structure;
add IOMEM_GET_FIELD64 to get u64 value of a member of a __iomem structure;
Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
drivers/staging/slicoss/slic.h | 32 +++++++++++++++++++++++++
drivers/staging/slicoss/slicoss.c | 49 +++++++++++++++++++++++++--------------
2 files changed, 64 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 022e7f6..fec9ec5 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 IOMEM_GET_FIELD32(base, member) \
({ \
char __iomem *_base = (char __iomem *)base; \
@@ -546,6 +553,31 @@ static inline void slic_flush_write(struct adapter *adapter)
ioread32(_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)) \
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 929a0d5..8426392 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
[toc] | [prev] | [next] | [standalone]
| From | Peng Sun <sironhide0null@gmail.com> |
|---|---|
| Date | 2016-09-17 04:10 +0200 |
| Subject | [PATCH 5/7] staging: slicoss: slicoss.c: fix different address space sparse warning |
| Message-ID | <sideN-4J0-11@gated-at.bofh.it> |
| In reply to | #1485466 |
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 c92b8c5..bf9b381 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); -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Peng Sun <sironhide0null@gmail.com> |
|---|---|
| Date | 2016-09-17 04:10 +0200 |
| Subject | [PATCH 6/7] staging: slicoss: slicoss.c: fix different address space sparse warning |
| Message-ID | <sideN-4J0-17@gated-at.bofh.it> |
| In reply to | #1485466 |
Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
drivers/staging/slicoss/slicoss.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index bf9b381..59c4fbc 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -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
[toc] | [prev] | [next] | [standalone]
| From | Greg KH <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2016-09-17 10:40 +0200 |
| Subject | Re: [PATCH 0/7] staging: slicoss: fix different address space sparse warnings |
| Message-ID | <sijkd-ei-15@gated-at.bofh.it> |
| In reply to | #1485466 |
On Fri, Sep 16, 2016 at 07:05:45PM -0700, Peng Sun wrote: > commit-id d221eb9f14f9, "Add linux-next specific files for 20160909" > > add several macros to fix these warnings > > Peng Sun (7): > 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 > staging: slicoss: slicoss.c: fix different address space sparse > warning All of these had the identical subject: line, but they do different things! Please fix them up and make them unique. thanks, greg k-h
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web