All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: mips-cm: Fix sparse warnings
@ 2015-01-05 15:45 ` James Hogan
  0 siblings, 0 replies; 3+ messages in thread
From: James Hogan @ 2015-01-05 15:45 UTC (permalink / raw)
  To: Ralf Baechle, linux-mips; +Cc: James Hogan, Paul Burton

Sparse emits a bunch of warnings in mips-cm.h due to casting away of
__iomem by the addr_gcr_*() functions:

arch/mips/include/asm/mips-cm.h:134:1: warning: cast removes address space of expression

And subsequent passing of the return values to __raw_readl() and
__raw_writel() in the read_gcr_*() and write_gcr_*() functions:

arch/mips/include/asm/mips-cm.h:134:1: warning: incorrect type in argument 2 (different address spaces)
arch/mips/include/asm/mips-cm.h:134:1:    expected void volatile [noderef] <asn:2>*mem
arch/mips/include/asm/mips-cm.h:134:1:    got unsigned int [usertype] *
arch/mips/include/asm/mips-cm.h:134:1: warning: incorrect type in argument 1 (different address spaces)
arch/mips/include/asm/mips-cm.h:134:1:    expected void const volatile [noderef] <asn:2>*mem
arch/mips/include/asm/mips-cm.h:134:1:    got unsigned int [usertype] *

Fix by adding __iomem to the addr_gcr_*() return type and cast.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
---
 arch/mips/include/asm/mips-cm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
index b95a827d763e..59c0901bdd84 100644
--- a/arch/mips/include/asm/mips-cm.h
+++ b/arch/mips/include/asm/mips-cm.h
@@ -89,9 +89,9 @@ static inline bool mips_cm_has_l2sync(void)
 
 /* Macros to ease the creation of register access functions */
 #define BUILD_CM_R_(name, off)					\
-static inline u32 *addr_gcr_##name(void)			\
+static inline u32 __iomem *addr_gcr_##name(void)		\
 {								\
-	return (u32 *)(mips_cm_base + (off));			\
+	return (u32 __iomem *)(mips_cm_base + (off));		\
 }								\
 								\
 static inline u32 read_gcr_##name(void)				\
-- 
2.0.5

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

* [PATCH] MIPS: mips-cm: Fix sparse warnings
@ 2015-01-05 15:45 ` James Hogan
  0 siblings, 0 replies; 3+ messages in thread
From: James Hogan @ 2015-01-05 15:45 UTC (permalink / raw)
  To: Ralf Baechle, linux-mips; +Cc: James Hogan, Paul Burton

Sparse emits a bunch of warnings in mips-cm.h due to casting away of
__iomem by the addr_gcr_*() functions:

arch/mips/include/asm/mips-cm.h:134:1: warning: cast removes address space of expression

And subsequent passing of the return values to __raw_readl() and
__raw_writel() in the read_gcr_*() and write_gcr_*() functions:

arch/mips/include/asm/mips-cm.h:134:1: warning: incorrect type in argument 2 (different address spaces)
arch/mips/include/asm/mips-cm.h:134:1:    expected void volatile [noderef] <asn:2>*mem
arch/mips/include/asm/mips-cm.h:134:1:    got unsigned int [usertype] *
arch/mips/include/asm/mips-cm.h:134:1: warning: incorrect type in argument 1 (different address spaces)
arch/mips/include/asm/mips-cm.h:134:1:    expected void const volatile [noderef] <asn:2>*mem
arch/mips/include/asm/mips-cm.h:134:1:    got unsigned int [usertype] *

Fix by adding __iomem to the addr_gcr_*() return type and cast.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
---
 arch/mips/include/asm/mips-cm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
index b95a827d763e..59c0901bdd84 100644
--- a/arch/mips/include/asm/mips-cm.h
+++ b/arch/mips/include/asm/mips-cm.h
@@ -89,9 +89,9 @@ static inline bool mips_cm_has_l2sync(void)
 
 /* Macros to ease the creation of register access functions */
 #define BUILD_CM_R_(name, off)					\
-static inline u32 *addr_gcr_##name(void)			\
+static inline u32 __iomem *addr_gcr_##name(void)		\
 {								\
-	return (u32 *)(mips_cm_base + (off));			\
+	return (u32 __iomem *)(mips_cm_base + (off));		\
 }								\
 								\
 static inline u32 read_gcr_##name(void)				\
-- 
2.0.5

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

* Re: [PATCH] MIPS: mips-cm: Fix sparse warnings
  2015-01-05 15:45 ` James Hogan
  (?)
@ 2015-01-05 17:45 ` Ralf Baechle
  -1 siblings, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2015-01-05 17:45 UTC (permalink / raw)
  To: James Hogan; +Cc: linux-mips, Paul Burton

On Mon, Jan 05, 2015 at 03:45:30PM +0000, James Hogan wrote:

> Sparse emits a bunch of warnings in mips-cm.h due to casting away of
> __iomem by the addr_gcr_*() functions:
> 
> arch/mips/include/asm/mips-cm.h:134:1: warning: cast removes address space of expression
> 
> And subsequent passing of the return values to __raw_readl() and
> __raw_writel() in the read_gcr_*() and write_gcr_*() functions:
> 
> arch/mips/include/asm/mips-cm.h:134:1: warning: incorrect type in argument 2 (different address spaces)
> arch/mips/include/asm/mips-cm.h:134:1:    expected void volatile [noderef] <asn:2>*mem
> arch/mips/include/asm/mips-cm.h:134:1:    got unsigned int [usertype] *
> arch/mips/include/asm/mips-cm.h:134:1: warning: incorrect type in argument 1 (different address spaces)
> arch/mips/include/asm/mips-cm.h:134:1:    expected void const volatile [noderef] <asn:2>*mem
> arch/mips/include/asm/mips-cm.h:134:1:    got unsigned int [usertype] *
> 
> Fix by adding __iomem to the addr_gcr_*() return type and cast.

Thanks, applied.

  Ralf

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

end of thread, other threads:[~2015-01-05 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-05 15:45 [PATCH] MIPS: mips-cm: Fix sparse warnings James Hogan
2015-01-05 15:45 ` James Hogan
2015-01-05 17:45 ` Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.