Re: [PATCH 19/24] sh: use __iomem pointers for MMIO

2012-09-18 Thread Arnd Bergmann
On Tuesday 18 September 2012, Paul Mundt wrote:
> On Fri, Sep 14, 2012 at 11:34:47PM +0200, Arnd Bergmann wrote:
> > 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.
> > 
> I have no intention of making this change for arch/sh.
> 
> The __raw variants already accept both __iomem pointers and integer
> addresses, which was largely intentional. New code could use the __iomem
> annotations while older code could continue to use the integer addresses
> without issue.

Ok, I'm dropping this patch from the series then.

> If you wish to go through the kernel and audit every
> single __raw user, you're certainly welcome to, but until then such a
> change is premature.

I've done it for all the defconfig files for now, which probably covers
most of the drivers that are relevant on ARM. I still have a backlog
of unrelated warning fixes from that. Once I'm done with those, I'm planning
to do another round of randconfig builds, which hopefully catches the
rest. I'll just exclude drivers/sh from those builds for now.

Arnd

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 19/24] sh: use __iomem pointers for MMIO

2012-09-18 Thread Paul Mundt
On Fri, Sep 14, 2012 at 11:34:47PM +0200, Arnd Bergmann wrote:
> 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.
> 
I have no intention of making this change for arch/sh.

The __raw variants already accept both __iomem pointers and integer
addresses, which was largely intentional. New code could use the __iomem
annotations while older code could continue to use the integer addresses
without issue. If you wish to go through the kernel and audit every
single __raw user, you're certainly welcome to, but until then such a
change is premature.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 19/24] sh: use __iomem pointers for MMIO

2012-09-18 Thread Paul Mundt
On Fri, Sep 14, 2012 at 11:34:47PM +0200, Arnd Bergmann wrote:
 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.
 
I have no intention of making this change for arch/sh.

The __raw variants already accept both __iomem pointers and integer
addresses, which was largely intentional. New code could use the __iomem
annotations while older code could continue to use the integer addresses
without issue. If you wish to go through the kernel and audit every
single __raw user, you're certainly welcome to, but until then such a
change is premature.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 19/24] sh: use __iomem pointers for MMIO

2012-09-18 Thread Arnd Bergmann
On Tuesday 18 September 2012, Paul Mundt wrote:
 On Fri, Sep 14, 2012 at 11:34:47PM +0200, Arnd Bergmann wrote:
  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.
  
 I have no intention of making this change for arch/sh.
 
 The __raw variants already accept both __iomem pointers and integer
 addresses, which was largely intentional. New code could use the __iomem
 annotations while older code could continue to use the integer addresses
 without issue.

Ok, I'm dropping this patch from the series then.

 If you wish to go through the kernel and audit every
 single __raw user, you're certainly welcome to, but until then such a
 change is premature.

I've done it for all the defconfig files for now, which probably covers
most of the drivers that are relevant on ARM. I still have a backlog
of unrelated warning fixes from that. Once I'm done with those, I'm planning
to do another round of randconfig builds, which hopefully catches the
rest. I'll just exclude drivers/sh from those builds for now.

Arnd

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 19/24] sh: use __iomem pointers for MMIO

2012-09-14 Thread Arnd Bergmann
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 
Cc: Magnus Damm 
Cc: Simon Horman 
Cc: Kuninori Morimoto 
Cc: linux...@vger.kernel.org
Signed-off-by: Arnd Bergmann 
---
 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 
 #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 * 

[PATCH 19/24] sh: use __iomem pointers for MMIO

2012-09-14 Thread Arnd Bergmann
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 let...@linux-sh.org
Cc: Magnus Damm magnus.d...@gmail.com
Cc: Simon Horman ho...@verge.net.au
Cc: Kuninori Morimoto kuninori.morimoto...@renesas.com
Cc: linux...@vger.kernel.org
Signed-off-by: Arnd Bergmann a...@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