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


Groups > linux.kernel > #1482896 > unrolled thread

[PATCH 00/10] staging: slicoss: fix different address space sparse warnings

Started byPeng Sun <sironhide0null@gmail.com>
First post2016-09-14 05:10 +0200
Last post2016-09-14 05:10 +0200
Articles 10 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/10] staging: slicoss: fix different address space sparse warnings Peng Sun <sironhide0null@gmail.com> - 2016-09-14 05:10 +0200
    [PATCH 05/10] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun <sironhide0null@gmail.com> - 2016-09-14 05:10 +0200
    [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings Peng Sun <sironhide0null@gmail.com> - 2016-09-14 05:10 +0200
      Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro  IOMEM_GET_FIELDADDR to fix sparse warnings Greg KH <gregkh@linuxfoundation.org> - 2016-09-16 10:00 +0200
      Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro  IOMEM_GET_FIELDADDR to fix sparse warnings Greg KH <gregkh@linuxfoundation.org> - 2016-09-16 10:00 +0200
        Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro  IOMEM_GET_FIELDADDR to fix sparse warnings zerons <sironhide0null@gmail.com> - 2016-09-16 12:50 +0200
          Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro  IOMEM_GET_FIELDADDR to fix sparse warnings Greg KH <gregkh@linuxfoundation.org> - 2016-09-16 15:00 +0200
            Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro  IOMEM_GET_FIELDADDR to fix sparse warnings zerons <sironhide0null@gmail.com> - 2016-09-16 16:00 +0200
    [PATCH 09/10] staging: slicoss: slicoss.c: fix different address space sparse warning Peng Sun <sironhide0null@gmail.com> - 2016-09-14 05:10 +0200
    [PATCH 03/10] staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 to fix sparse warnings Peng Sun <sironhide0null@gmail.com> - 2016-09-14 05:10 +0200

#1482896 — [PATCH 00/10] staging: slicoss: fix different address space sparse warnings

FromPeng Sun <sironhide0null@gmail.com>
Date2016-09-14 05:10 +0200
Subject[PATCH 00/10] staging: slicoss: fix different address space sparse warnings
Message-ID<sh8Kd-2KP-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1482897 — [PATCH 05/10] staging: slicoss: slicoss.c: fix different address space sparse warning

FromPeng Sun <sironhide0null@gmail.com>
Date2016-09-14 05:10 +0200
Subject[PATCH 05/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Message-ID<sh8Kd-2KP-11@gated-at.bofh.it>
In reply to#1482896
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

[toc] | [prev] | [next] | [standalone]


#1482898 — [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings

FromPeng Sun <sironhide0null@gmail.com>
Date2016-09-14 05:10 +0200
Subject[PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
Message-ID<sh8Ke-2KP-27@gated-at.bofh.it>
In reply to#1482896
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

[toc] | [prev] | [next] | [standalone]


#1484754 — Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-09-16 10:00 +0200
SubjectRe: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
Message-ID<shWdX-1I1-7@gated-at.bofh.it>
In reply to#1482898
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

[toc] | [prev] | [next] | [standalone]


#1484758 — Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-09-16 10:00 +0200
SubjectRe: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
Message-ID<shWdY-1I1-25@gated-at.bofh.it>
In reply to#1482898
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

[toc] | [prev] | [next] | [standalone]


#1484867 — Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings

Fromzerons <sironhide0null@gmail.com>
Date2016-09-16 12:50 +0200
SubjectRe: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
Message-ID<shYSu-3xA-19@gated-at.bofh.it>
In reply to#1484758
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
> 

[toc] | [prev] | [next] | [standalone]


#1484972 — Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-09-16 15:00 +0200
SubjectRe: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
Message-ID<si0Ui-4PI-3@gated-at.bofh.it>
In reply to#1484867
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

[toc] | [prev] | [next] | [standalone]


#1485006 — Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings

Fromzerons <sironhide0null@gmail.com>
Date2016-09-16 16:00 +0200
SubjectRe: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
Message-ID<si1Ql-5pB-11@gated-at.bofh.it>
In reply to#1484972

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.

[toc] | [prev] | [next] | [standalone]


#1482899 — [PATCH 09/10] staging: slicoss: slicoss.c: fix different address space sparse warning

FromPeng Sun <sironhide0null@gmail.com>
Date2016-09-14 05:10 +0200
Subject[PATCH 09/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Message-ID<sh8Kd-2KP-25@gated-at.bofh.it>
In reply to#1482896
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

[toc] | [prev] | [next] | [standalone]


#1482900 — [PATCH 03/10] staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 to fix sparse warnings

FromPeng Sun <sironhide0null@gmail.com>
Date2016-09-14 05:10 +0200
Subject[PATCH 03/10] staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 to fix sparse warnings
Message-ID<sh8Ke-2KP-29@gated-at.bofh.it>
In reply to#1482896
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web