linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, Will Deacon <will.deacon@arm.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Nicolas Pitre <nico@linaro.org>, Arnd Bergmann <arnd@arndb.de>,
	Paul Mundt <lethal@linux-sh.org>,
	Magnus Damm <magnus.damm@gmail.com>,
	Simon Horman <horms@verge.net.au>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	linux-sh@vger.kernel.org
Subject: [PATCH 19/24] sh: use __iomem pointers for MMIO
Date: Fri, 14 Sep 2012 23:34:47 +0200	[thread overview]
Message-ID: <1347658492-11608-20-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1347658492-11608-1-git-send-email-arnd@arndb.de>

ARM is moving to stricter checks on readl/write functions,
so we need to use the correct types everywhere.

I'm not completely sure about this patch, and it will
probably require some arch/sh changes to go along with it,
but it's clear that something has to be done to avoid
getting hundreds of new warnings on each shmobile build
in v3.7.
Please see this as a prototype.

Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Simon Horman <horms@verge.net.au>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/sh/intc/access.c    |   56 +++++++++++++++++++++----------------------
 drivers/sh/intc/chip.c      |    8 +++----
 drivers/sh/intc/core.c      |    6 +++--
 drivers/sh/intc/handle.c    |    6 ++---
 drivers/sh/intc/internals.h |   18 +++++++-------
 drivers/sh/intc/virq.c      |    3 ++-
 include/linux/sh_clk.h      |    4 ++--
 7 files changed, 52 insertions(+), 49 deletions(-)

diff --git a/drivers/sh/intc/access.c b/drivers/sh/intc/access.c
index f892ae1..5bd0a56 100644
--- a/drivers/sh/intc/access.c
+++ b/drivers/sh/intc/access.c
@@ -11,7 +11,7 @@
 #include <linux/io.h>
 #include "internals.h"
 
-unsigned long intc_phys_to_virt(struct intc_desc_int *d, unsigned long address)
+void __iomem *intc_phys_to_virt(struct intc_desc_int *d, unsigned long address)
 {
 	struct intc_window *window;
 	int k;
@@ -27,23 +27,23 @@ unsigned long intc_phys_to_virt(struct intc_desc_int *d, unsigned long address)
 			continue;
 
 		address -= window->phys;
-		address += (unsigned long)window->virt;
 
-		return address;
+		return window->virt + address;
 	}
 
 	/* no windows defined, register must be 1:1 mapped virt:phys */
-	return address;
+	return (void __iomem *)address;
 }
 
 unsigned int intc_get_reg(struct intc_desc_int *d, unsigned long address)
 {
 	unsigned int k;
+	void __iomem *virt;
 
-	address = intc_phys_to_virt(d, address);
+	virt = intc_phys_to_virt(d, address);
 
 	for (k = 0; k < d->nr_reg; k++) {
-		if (d->reg[k] == address)
+		if (d->reg[k] == virt)
 			return k;
 	}
 
@@ -72,25 +72,25 @@ unsigned long intc_get_field_from_handle(unsigned int value, unsigned int handle
 	return (value & mask) >> shift;
 }
 
-static unsigned long test_8(unsigned long addr, unsigned long h,
+static unsigned long test_8(void __iomem * addr, unsigned long h,
 			    unsigned long ignore)
 {
 	return intc_get_field_from_handle(__raw_readb(addr), h);
 }
 
-static unsigned long test_16(unsigned long addr, unsigned long h,
+static unsigned long test_16(void __iomem * addr, unsigned long h,
 			     unsigned long ignore)
 {
 	return intc_get_field_from_handle(__raw_readw(addr), h);
 }
 
-static unsigned long test_32(unsigned long addr, unsigned long h,
+static unsigned long test_32(void __iomem * addr, unsigned long h,
 			     unsigned long ignore)
 {
 	return intc_get_field_from_handle(__raw_readl(addr), h);
 }
 
-static unsigned long write_8(unsigned long addr, unsigned long h,
+static unsigned long write_8(void __iomem * addr, unsigned long h,
 			     unsigned long data)
 {
 	__raw_writeb(intc_set_field_from_handle(0, data, h), addr);
@@ -98,7 +98,7 @@ static unsigned long write_8(unsigned long addr, unsigned long h,
 	return 0;
 }
 
-static unsigned long write_16(unsigned long addr, unsigned long h,
+static unsigned long write_16(void __iomem * addr, unsigned long h,
 			      unsigned long data)
 {
 	__raw_writew(intc_set_field_from_handle(0, data, h), addr);
@@ -106,7 +106,7 @@ static unsigned long write_16(unsigned long addr, unsigned long h,
 	return 0;
 }
 
-static unsigned long write_32(unsigned long addr, unsigned long h,
+static unsigned long write_32(void __iomem * addr, unsigned long h,
 			      unsigned long data)
 {
 	__raw_writel(intc_set_field_from_handle(0, data, h), addr);
@@ -114,7 +114,7 @@ static unsigned long write_32(unsigned long addr, unsigned long h,
 	return 0;
 }
 
-static unsigned long modify_8(unsigned long addr, unsigned long h,
+static unsigned long modify_8(void __iomem * addr, unsigned long h,
 			      unsigned long data)
 {
 	unsigned long flags;
@@ -127,7 +127,7 @@ static unsigned long modify_8(unsigned long addr, unsigned long h,
 	return 0;
 }
 
-static unsigned long modify_16(unsigned long addr, unsigned long h,
+static unsigned long modify_16(void __iomem * addr, unsigned long h,
 			       unsigned long data)
 {
 	unsigned long flags;
@@ -140,7 +140,7 @@ static unsigned long modify_16(unsigned long addr, unsigned long h,
 	return 0;
 }
 
-static unsigned long modify_32(unsigned long addr, unsigned long h,
+static unsigned long modify_32(void __iomem * addr, unsigned long h,
 			       unsigned long data)
 {
 	unsigned long flags;
@@ -153,9 +153,9 @@ static unsigned long modify_32(unsigned long addr, unsigned long h,
 	return 0;
 }
 
-static unsigned long intc_mode_field(unsigned long addr,
+static unsigned long intc_mode_field(void __iomem * addr,
 				     unsigned long handle,
-				     unsigned long (*fn)(unsigned long,
+				     unsigned long (*fn)(void __iomem *addr,
 						unsigned long,
 						unsigned long),
 				     unsigned int irq)
@@ -163,9 +163,9 @@ static unsigned long intc_mode_field(unsigned long addr,
 	return fn(addr, handle, ((1 << _INTC_WIDTH(handle)) - 1));
 }
 
-static unsigned long intc_mode_zero(unsigned long addr,
+static unsigned long intc_mode_zero(void __iomem * addr,
 				    unsigned long handle,
-				    unsigned long (*fn)(unsigned long,
+				    unsigned long (*fn)(void __iomem *addr,
 					       unsigned long,
 					       unsigned long),
 				    unsigned int irq)
@@ -173,9 +173,9 @@ static unsigned long intc_mode_zero(unsigned long addr,
 	return fn(addr, handle, 0);
 }
 
-static unsigned long intc_mode_prio(unsigned long addr,
+static unsigned long intc_mode_prio(void __iomem * addr,
 				    unsigned long handle,
-				    unsigned long (*fn)(unsigned long,
+				    unsigned long (*fn)(void __iomem *addr,
 					       unsigned long,
 					       unsigned long),
 				    unsigned int irq)
@@ -183,7 +183,7 @@ static unsigned long intc_mode_prio(unsigned long addr,
 	return fn(addr, handle, intc_get_prio_level(irq));
 }
 
-unsigned long (*intc_reg_fns[])(unsigned long addr,
+unsigned long (*intc_reg_fns[])(void __iomem * addr,
 				unsigned long h,
 				unsigned long data) = {
 	[REG_FN_TEST_BASE + 0] = test_8,
@@ -197,9 +197,9 @@ unsigned long (*intc_reg_fns[])(unsigned long addr,
 	[REG_FN_MODIFY_BASE + 3] = modify_32,
 };
 
-unsigned long (*intc_enable_fns[])(unsigned long addr,
+unsigned long (*intc_enable_fns[])(void __iomem * addr,
 				   unsigned long handle,
-				   unsigned long (*fn)(unsigned long,
+				   unsigned long (*fn)(void __iomem *,
 					    unsigned long,
 					    unsigned long),
 				   unsigned int irq) = {
@@ -210,9 +210,9 @@ unsigned long (*intc_enable_fns[])(unsigned long addr,
 	[MODE_PCLR_REG] = intc_mode_prio,
 };
 
-unsigned long (*intc_disable_fns[])(unsigned long addr,
+unsigned long (*intc_disable_fns[])(void __iomem * addr,
 				    unsigned long handle,
-				    unsigned long (*fn)(unsigned long,
+				    unsigned long (*fn)(void __iomem *,
 					     unsigned long,
 					     unsigned long),
 				    unsigned int irq) = {
@@ -223,9 +223,9 @@ unsigned long (*intc_disable_fns[])(unsigned long addr,
 	[MODE_PCLR_REG] = intc_mode_field,
 };
 
-unsigned long (*intc_enable_noprio_fns[])(unsigned long addr,
+unsigned long (*intc_enable_noprio_fns[])(void __iomem * addr,
 					  unsigned long handle,
-					  unsigned long (*fn)(unsigned long,
+					  unsigned long (*fn)(void __iomem *,
 						unsigned long,
 						unsigned long),
 					  unsigned int irq) = {
diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
index 012df26..2928264 100644
--- a/drivers/sh/intc/chip.c
+++ b/drivers/sh/intc/chip.c
@@ -17,7 +17,7 @@ void _intc_enable(struct irq_data *data, unsigned long handle)
 {
 	unsigned int irq = data->irq;
 	struct intc_desc_int *d = get_intc_desc(irq);
-	unsigned long addr;
+	void __iomem *addr;
 	unsigned int cpu;
 
 	for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
@@ -43,7 +43,7 @@ static void intc_disable(struct irq_data *data)
 	unsigned int irq = data->irq;
 	struct intc_desc_int *d = get_intc_desc(irq);
 	unsigned long handle = (unsigned long)irq_data_get_irq_chip_data(data);
-	unsigned long addr;
+	void __iomem *addr;
 	unsigned int cpu;
 
 	intc_balancing_disable(irq);
@@ -83,7 +83,7 @@ static void intc_mask_ack(struct irq_data *data)
 	unsigned int irq = data->irq;
 	struct intc_desc_int *d = get_intc_desc(irq);
 	unsigned long handle = intc_get_ack_handle(irq);
-	unsigned long addr;
+	void __iomem * addr;
 
 	intc_disable(data);
 
@@ -177,7 +177,7 @@ static int intc_set_type(struct irq_data *data, unsigned int type)
 	struct intc_desc_int *d = get_intc_desc(irq);
 	unsigned char value = intc_irq_sense_table[type & IRQ_TYPE_SENSE_MASK];
 	struct intc_handle_int *ihp;
-	unsigned long addr;
+	void __iomem *addr;
 
 	if (!value)
 		return -EINVAL;
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 32c26d7..1ddbba0 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -172,10 +172,12 @@ static unsigned int __init save_reg(struct intc_desc_int *d,
 				    unsigned long value,
 				    unsigned int smp)
 {
+	void __iomem *virt;
+
 	if (value) {
-		value = intc_phys_to_virt(d, value);
+		virt = intc_phys_to_virt(d, value);
 
-		d->reg[cnt] = value;
+		d->reg[cnt] = virt;
 #ifdef CONFIG_SMP
 		d->smp[cnt] = smp;
 #endif
diff --git a/drivers/sh/intc/handle.c b/drivers/sh/intc/handle.c
index 7863a44..1971ef1 100644
--- a/drivers/sh/intc/handle.c
+++ b/drivers/sh/intc/handle.c
@@ -206,10 +206,10 @@ static unsigned int intc_ack_data(struct intc_desc *desc,
 static void intc_enable_disable(struct intc_desc_int *d,
 				unsigned long handle, int do_enable)
 {
-	unsigned long addr;
+	void __iomem *addr;
 	unsigned int cpu;
-	unsigned long (*fn)(unsigned long, unsigned long,
-		   unsigned long (*)(unsigned long, unsigned long,
+	unsigned long(*fn)(void __iomem *, unsigned long,
+		   unsigned long (*)(void __iomem *, unsigned long,
 				     unsigned long),
 		   unsigned int);
 
diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
index 7dff08e..29e4299 100644
--- a/drivers/sh/intc/internals.h
+++ b/drivers/sh/intc/internals.h
@@ -56,7 +56,7 @@ struct intc_desc_int {
 	struct radix_tree_root tree;
 	raw_spinlock_t lock;
 	unsigned int index;
-	unsigned long *reg;
+	void * __iomem *reg;
 #ifdef CONFIG_SMP
 	unsigned long *smp;
 #endif
@@ -120,25 +120,25 @@ static inline int intc_handle_int_cmp(const void *a, const void *b)
 
 /* access.c */
 extern unsigned long
-(*intc_reg_fns[])(unsigned long addr, unsigned long h, unsigned long data);
+(*intc_reg_fns[])(void __iomem * addr, unsigned long h, unsigned long data);
 
 extern unsigned long
-(*intc_enable_fns[])(unsigned long addr, unsigned long handle,
-		     unsigned long (*fn)(unsigned long,
+(*intc_enable_fns[])(void __iomem * addr, unsigned long handle,
+		     unsigned long (*fn)(void __iomem *,
 				unsigned long, unsigned long),
 		     unsigned int irq);
 extern unsigned long
-(*intc_disable_fns[])(unsigned long addr, unsigned long handle,
-		      unsigned long (*fn)(unsigned long,
+(*intc_disable_fns[])(void __iomem * addr, unsigned long handle,
+		      unsigned long (*fn)(void __iomem *,
 				unsigned long, unsigned long),
 		      unsigned int irq);
 extern unsigned long
-(*intc_enable_noprio_fns[])(unsigned long addr, unsigned long handle,
-		            unsigned long (*fn)(unsigned long,
+(*intc_enable_noprio_fns[])(void __iomem * addr, unsigned long handle,
+		            unsigned long (*fn)(void __iomem *,
 				unsigned long, unsigned long),
 			    unsigned int irq);
 
-unsigned long intc_phys_to_virt(struct intc_desc_int *d, unsigned long address);
+void __iomem * intc_phys_to_virt(struct intc_desc_int *d, unsigned long address);
 unsigned int intc_get_reg(struct intc_desc_int *d, unsigned long address);
 unsigned int intc_set_field_from_handle(unsigned int value,
 			    unsigned int field_value,
diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
index f30ac93..d45cfcd 100644
--- a/drivers/sh/intc/virq.c
+++ b/drivers/sh/intc/virq.c
@@ -117,7 +117,8 @@ static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
 	chip->irq_mask_ack(data);
 
 	for_each_virq(entry, vlist) {
-		unsigned long addr, handle;
+		void __iomem *addr;
+		unsigned long handle;
 
 		handle = (unsigned long)irq_get_handler_data(entry->irq);
 		addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 5091091..6579041 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -173,7 +173,7 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
 #define SH_CLK_DIV6_EXT(_reg, _flags, _parents,			\
 			_num_parents, _src_shift, _src_width)	\
 {								\
-	.enable_reg = (void __iomem *)_reg,			\
+	.enable_reg = _reg,					\
 	.enable_bit = 0, /* unused */				\
 	.flags = _flags | CLK_MASK_DIV_ON_DISABLE,		\
 	.div_mask = SH_CLK_DIV6_MSK,				\
@@ -186,7 +186,7 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
 #define SH_CLK_DIV6(_parent, _reg, _flags)			\
 {								\
 	.parent		= _parent,				\
-	.enable_reg	= (void __iomem *)_reg,			\
+	.enable_reg	= _reg,					\
 	.enable_bit	= 0,	/* unused */			\
 	.div_mask	= SH_CLK_DIV6_MSK,			\
 	.flags		= _flags | CLK_MASK_DIV_ON_DISABLE,	\
-- 
1.7.10


  parent reply	other threads:[~2012-09-14 21:36 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1347658492-11608-1-git-send-email-arnd@arndb.de>
2012-09-14 21:34 ` [PATCH 01/24] ARM: shmobile: use __iomem pointers for MMIO Arnd Bergmann
2012-09-18  7:11   ` Simon Horman
2012-09-18  8:31     ` Arnd Bergmann
2012-09-18 11:50       ` Simon Horman
2012-09-18 16:04         ` Arnd Bergmann
2012-09-18 23:56           ` Simon Horman
2012-09-18  7:42   ` Paul Mundt
2012-09-14 21:34 ` [PATCH 02/24] ARM: at91: " Arnd Bergmann
2012-09-17  7:56   ` Nicolas Ferre
2012-09-18  8:05     ` Arnd Bergmann
2012-09-14 21:34 ` [PATCH 03/24] ARM: ebsa110: " Arnd Bergmann
2012-09-14 21:34 ` [PATCH 04/24] ARM: ep93xx: " Arnd Bergmann
2012-09-14 22:14   ` Ryan Mallon
2012-09-15  7:55     ` Arnd Bergmann
2012-09-14 21:34 ` [PATCH 05/24] ARM: imx: " Arnd Bergmann
2012-09-14 22:31   ` Fabio Estevam
2012-09-15 17:42     ` Arnd Bergmann
2012-09-16  7:21       ` Sascha Hauer
2012-09-14 21:34 ` [PATCH 06/24] ARM: integrator: " Arnd Bergmann
2012-09-16 22:19   ` Linus Walleij
2012-09-16 22:35     ` Russell King - ARM Linux
2012-09-16 22:46       ` Linus Walleij
2012-09-16 23:43         ` Russell King - ARM Linux
2012-09-14 21:34 ` [PATCH 07/24] ARM: iop13xx: " Arnd Bergmann
2012-09-14 21:34 ` [PATCH 08/24] ARM: iop32x: " Arnd Bergmann
2012-09-14 21:34 ` [PATCH 09/24] ARM: ixp4xx: " Arnd Bergmann
2012-09-18 10:31   ` Krzysztof Halasa
2012-09-18 19:22     ` Krzysztof Halasa
2012-09-19 13:52       ` Arnd Bergmann
2012-09-18 20:12   ` [PATCH 08+09/24] " Krzysztof Halasa
2012-09-18 21:25     ` Arnd Bergmann
2012-09-14 21:34 ` [PATCH 10/24] ARM: ks8695: " Arnd Bergmann
2012-09-14 21:34 ` [PATCH 11/24] ARM: lpc32xx: " Arnd Bergmann
2012-09-14 21:34 ` [PATCH 12/24] ARM: msm: " Arnd Bergmann
2012-09-14 22:38   ` Stephen Boyd
2012-09-15  5:16     ` David Brown
2012-09-14 21:34 ` [PATCH 13/24] ARM: nomadik: " Arnd Bergmann
2012-09-16 22:24   ` Linus Walleij
2012-09-14 21:34 ` [PATCH 14/24] ARM: prima2: " Arnd Bergmann
2012-09-14 21:34 ` [PATCH 15/24] ARM: sa1100: " Arnd Bergmann
2012-09-14 21:34 ` [PATCH 16/24] ARM: spear13xx: " Arnd Bergmann
2012-09-14 21:34 ` [PATCH 17/24] ARM: OMAP: " Arnd Bergmann
2012-09-15 18:10   ` Tony Lindgren
2012-09-15 20:14     ` Arnd Bergmann
2012-09-16 20:38       ` Tony Lindgren
2012-09-17 21:25         ` Tony Lindgren
2012-09-19 13:35           ` Arnd Bergmann
2012-09-19 13:36             ` Felipe Balbi
2012-09-19 16:44               ` Tony Lindgren
2012-09-14 21:34 ` [PATCH 18/24] ARM: samsung: " Arnd Bergmann
2012-09-14 21:34 ` Arnd Bergmann [this message]
2012-09-18  7:37   ` [PATCH 19/24] sh: " Paul Mundt
2012-09-18  8:01     ` Arnd Bergmann
2012-09-14 21:34 ` [PATCH 20/24] input: rpcmouse: " Arnd Bergmann
2012-09-19 17:06   ` Dmitry Torokhov
2012-09-14 21:34 ` [PATCH 21/24] serial: ks8695: " Arnd Bergmann
2012-09-14 23:44   ` Greg Kroah-Hartman
2012-09-14 21:34 ` [PATCH 22/24] scsi: eesox: " Arnd Bergmann
2012-09-14 23:27   ` Russell King - ARM Linux
2012-09-15  8:00     ` Arnd Bergmann
2012-09-15  8:57       ` Russell King - ARM Linux
2012-09-15 10:30         ` Arnd Bergmann
2012-09-17 22:03           ` Russell King - ARM Linux
2012-09-18  8:09             ` Arnd Bergmann
2012-09-14 21:34 ` [PATCH 23/24] video: da8xx-fb: " Arnd Bergmann
2012-09-14 21:34 ` [PATCH 24/24] net: seeq: " Arnd Bergmann
2012-09-14 23:56   ` Russell King - ARM Linux
2012-09-15  4:00     ` David Miller
2012-09-18  8:14       ` Arnd Bergmann
2012-09-15 11:33 ` [PATCH 13/24] ARM: nomadik: " Alessandro Rubini
2012-09-28 20:13   ` Arnd Bergmann

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=1347658492-11608-20-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=horms@verge.net.au \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=nico@linaro.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).