linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eric.y.miao@gmail.com (Eric Miao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 13/26] ARM: pxa: use correct __iomem annotations
Date: Fri, 7 Oct 2011 16:11:01 +0800	[thread overview]
Message-ID: <CAMPhdO_CGvoc8GZQS3TWpv0gqOXhmHyEbamcQr28K5iLgOBnuw@mail.gmail.com> (raw)
In-Reply-To: <1317499438-14058-14-git-send-email-arnd@arndb.de>

On Sun, Oct 2, 2011 at 4:03 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> This tries to clear up the confusion between integers and iomem pointers
> in the marvell pxa platform. MMIO addresses are supposed to be __iomem*
> values, in order to let the Linux type checking work correctly. This
> patch moves the cast to __iomem as far back as possible, to the place
> where the MMIO virtual address windows are defined.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> ?arch/arm/include/asm/hardware/it8152.h ? ?| ? ?2 +-
> ?arch/arm/mach-mmp/clock.h ? ? ? ? ? ? ? ? | ? ?8 ++++----
> ?arch/arm/mach-mmp/common.c ? ? ? ? ? ? ? ?| ? ?4 ++--
> ?arch/arm/mach-mmp/include/mach/addr-map.h | ? 10 ++++++++--
> ?arch/arm/mach-mmp/mmp2.c ? ? ? ? ? ? ? ? ?| ? ?3 ++-
> ?arch/arm/mach-pxa/balloon3.c ? ? ? ? ? ? ?| ? 10 +++++-----
> ?arch/arm/mach-pxa/cm-x2xx-pci.c ? ? ? ? ? | ? ?2 +-
> ?arch/arm/mach-pxa/cm-x2xx.c ? ? ? ? ? ? ? | ? ?4 ++--
> ?arch/arm/mach-pxa/include/mach/addr-map.h | ? ?8 ++++----
> ?arch/arm/mach-pxa/include/mach/balloon3.h | ? ?2 +-
> ?arch/arm/mach-pxa/include/mach/hardware.h | ? ?9 +++++----
> ?arch/arm/mach-pxa/include/mach/lpd270.h ? | ? ?4 ++--
> ?arch/arm/mach-pxa/include/mach/mtd-xip.h ?| ? ?1 -
> ?arch/arm/mach-pxa/include/mach/palmtx.h ? | ? ?6 +++---
> ?arch/arm/mach-pxa/include/mach/smemc.h ? ?| ? ?2 +-
> ?arch/arm/mach-pxa/include/mach/zeus.h ? ? | ? ?4 ++--
> ?arch/arm/mach-pxa/irq.c ? ? ? ? ? ? ? ? ? | ? ?4 ++--
> ?arch/arm/mach-pxa/lpd270.c ? ? ? ? ? ? ? ?| ? ?2 +-
> ?arch/arm/mach-pxa/palmtx.c ? ? ? ? ? ? ? ?| ? ?8 ++++----
> ?arch/arm/mach-pxa/pxa25x.c ? ? ? ? ? ? ? ?| ? ?2 +-
> ?arch/arm/mach-pxa/pxa27x.c ? ? ? ? ? ? ? ?| ? ?2 +-
> ?arch/arm/mach-pxa/pxa3xx.c ? ? ? ? ? ? ? ?| ? ?2 +-
> ?arch/arm/mach-pxa/zeus.c ? ? ? ? ? ? ? ? ?| ? ?8 ++++----
> ?arch/arm/plat-pxa/gpio.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?arch/arm/plat-pxa/include/plat/mfp.h ? ? ?| ? ?2 +-
> ?arch/arm/plat-pxa/mfp.c ? ? ? ? ? ? ? ? ? | ? ?4 ++--
> ?drivers/pcmcia/pxa2xx_balloon3.c ? ? ? ? ?| ? ?2 +-
> ?drivers/video/mbx/mbxfb.c ? ? ? ? ? ? ? ? | ? ?6 +++---
> ?28 files changed, 65 insertions(+), 58 deletions(-)
>
> diff --git a/arch/arm/include/asm/hardware/it8152.h b/arch/arm/include/asm/hardware/it8152.h
> index b3fea38..43cab49 100644
> --- a/arch/arm/include/asm/hardware/it8152.h
> +++ b/arch/arm/include/asm/hardware/it8152.h
> @@ -9,7 +9,7 @@
>
> ?#ifndef __ASM_HARDWARE_IT8152_H
> ?#define __ASM_HARDWARE_IT8152_H
> -extern unsigned long it8152_base_address;
> +extern void __iomem *it8152_base_address;
>
> ?#define IT8152_IO_BASE ? ? ? ? ? ? ? ? (it8152_base_address + 0x03e00000)
> ?#define IT8152_CFGREG_BASE ? ? ? ? ? ? (it8152_base_address + 0x03f00000)
> diff --git a/arch/arm/mach-mmp/clock.h b/arch/arm/mach-mmp/clock.h
> index 3143e99..149b30c 100644
> --- a/arch/arm/mach-mmp/clock.h
> +++ b/arch/arm/mach-mmp/clock.h
> @@ -30,7 +30,7 @@ extern struct clkops apmu_clk_ops;
>
> ?#define APBC_CLK(_name, _reg, _fnclksel, _rate) ? ? ? ? ? ? ? ? ? ? ? ?\
> ?struct clk clk_##_name = { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> - ? ? ? ? ? ? ? .clk_rst ? ? ? ?= (void __iomem *)APBC_##_reg, ?\
> + ? ? ? ? ? ? ? .clk_rst ? ? ? ?= APBC_##_reg, ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.fnclksel ? ? ? = _fnclksel, ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.rate ? ? ? ? ? = _rate, ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.ops ? ? ? ? ? ?= &apbc_clk_ops, ? ? ? ? ? ? ? ?\
> @@ -38,7 +38,7 @@ struct clk clk_##_name = { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>
> ?#define APBC_CLK_OPS(_name, _reg, _fnclksel, _rate, _ops) ? ? ?\
> ?struct clk clk_##_name = { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> - ? ? ? ? ? ? ? .clk_rst ? ? ? ?= (void __iomem *)APBC_##_reg, ?\
> + ? ? ? ? ? ? ? .clk_rst ? ? ? ?= APBC_##_reg, ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.fnclksel ? ? ? = _fnclksel, ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.rate ? ? ? ? ? = _rate, ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.ops ? ? ? ? ? ?= _ops, ? ? ? ? ? ? ? ? ? ? ? ? \
> @@ -46,7 +46,7 @@ struct clk clk_##_name = { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>
> ?#define APMU_CLK(_name, _reg, _eval, _rate) ? ? ? ? ? ? ? ? ? ?\
> ?struct clk clk_##_name = { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> - ? ? ? ? ? ? ? .clk_rst ? ? ? ?= (void __iomem *)APMU_##_reg, ?\
> + ? ? ? ? ? ? ? .clk_rst ? ? ? ?= APMU_##_reg, ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.enable_val ? ? = _eval, ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.rate ? ? ? ? ? = _rate, ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.ops ? ? ? ? ? ?= &apmu_clk_ops, ? ? ? ? ? ? ? ?\
> @@ -54,7 +54,7 @@ struct clk clk_##_name = { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>
> ?#define APMU_CLK_OPS(_name, _reg, _eval, _rate, _ops) ? ? ? ? ?\
> ?struct clk clk_##_name = { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> - ? ? ? ? ? ? ? .clk_rst ? ? ? ?= (void __iomem *)APMU_##_reg, ?\
> + ? ? ? ? ? ? ? .clk_rst ? ? ? ?= APMU_##_reg, ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.enable_val ? ? = _eval, ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.rate ? ? ? ? ? = _rate, ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ?.ops ? ? ? ? ? ?= _ops, ? ? ? ? ? ? ? ? ? ? ? ? \
> diff --git a/arch/arm/mach-mmp/common.c b/arch/arm/mach-mmp/common.c
> index 0ec0ca8..5720674 100644
> --- a/arch/arm/mach-mmp/common.c
> +++ b/arch/arm/mach-mmp/common.c
> @@ -27,12 +27,12 @@ EXPORT_SYMBOL(mmp_chip_id);
> ?static struct map_desc standard_io_desc[] __initdata = {
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.pfn ? ? ? ? ? ?= __phys_to_pfn(APB_PHYS_BASE),
> - ? ? ? ? ? ? ? .virtual ? ? ? ?= APB_VIRT_BASE,
> + ? ? ? ? ? ? ? .virtual ? ? ? ?= (unsigned long)APB_VIRT_BASE,
> ? ? ? ? ? ? ? ?.length ? ? ? ? = APB_PHYS_SIZE,
> ? ? ? ? ? ? ? ?.type ? ? ? ? ? = MT_DEVICE,
> ? ? ? ?}, {
> ? ? ? ? ? ? ? ?.pfn ? ? ? ? ? ?= __phys_to_pfn(AXI_PHYS_BASE),
> - ? ? ? ? ? ? ? .virtual ? ? ? ?= AXI_VIRT_BASE,
> + ? ? ? ? ? ? ? .virtual ? ? ? ?= (unsigned long)AXI_VIRT_BASE,
> ? ? ? ? ? ? ? ?.length ? ? ? ? = AXI_PHYS_SIZE,
> ? ? ? ? ? ? ? ?.type ? ? ? ? ? = MT_DEVICE,
> ? ? ? ?},
> diff --git a/arch/arm/mach-mmp/include/mach/addr-map.h b/arch/arm/mach-mmp/include/mach/addr-map.h
> index 3254089..3e404ac 100644
> --- a/arch/arm/mach-mmp/include/mach/addr-map.h
> +++ b/arch/arm/mach-mmp/include/mach/addr-map.h
> @@ -11,6 +11,12 @@
> ?#ifndef __ASM_MACH_ADDR_MAP_H
> ?#define __ASM_MACH_ADDR_MAP_H
>
> +#ifndef __ASSEMBLER__
> +#define IOMEM(x) ? ? ? ((void __iomem *)(x))
> +#else
> +#define IOMEM(x) ? ? ? (x)
> +#endif
> +
> ?/* APB - Application Subsystem Peripheral Bus
> ?*
> ?* NOTE: the DMA controller registers are actually on the AXI fabric #1
> @@ -18,11 +24,11 @@
> ?* peripherals on APB, let's count it into the ABP mapping area.
> ?*/
> ?#define APB_PHYS_BASE ? ? ? ? ?0xd4000000
> -#define APB_VIRT_BASE ? ? ? ? ?0xfe000000
> +#define APB_VIRT_BASE ? ? ? ? ?IOMEM(0xfe000000)

To be honest, I'd really like to keep the *_VIRT_BASE definitions to be
type independent.

And have the actual register definitions to be casted to void __iomem *
when being defined, e.g.

#define APBC_REG(x)	IOMEM(APBC_VIRT_BASE + (x))

#define APBC_UART1	APBC_REG(0x000)

Arnd, do we have some standard guidelines on this for all SoCs
to follow? As I know, it's currently still being a mess.

  reply	other threads:[~2011-10-07  8:11 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-01 20:03 [PATCH 00/26] ARM: pxa specific randconfig fixes Arnd Bergmann
2011-10-01 20:03 ` [PATCH 01/26] usb/gadget/pxa25x: is_vbus_present is gone Arnd Bergmann
2011-10-06 12:19   ` Felipe Balbi
2011-10-07  2:27   ` Eric Miao
2011-10-01 20:03 ` [PATCH 02/26] sound/pxa-zylonite: use a valid device for dev_err() Arnd Bergmann
2011-10-02 18:16   ` Mark Brown
2011-10-02 18:36     ` Arnd Bergmann
2011-10-02 18:44       ` Mark Brown
2011-10-02 19:48         ` Arnd Bergmann
2011-10-02 18:24   ` Mark Brown
2011-10-01 20:03 ` [PATCH 03/26] scsi/mvsas: use proper namespace for IRQ_* symbols Arnd Bergmann
2011-10-01 20:03 ` [PATCH 04/26] net/pxa168_eth: add missing include of interrupt.h Arnd Bergmann
2011-10-07  3:48   ` Eric Miao
2011-10-01 20:03 ` [PATCH 05/26] ARM: pxa: make zylonite_pxa*_init declaration match code Arnd Bergmann
2011-10-07  3:47   ` Eric Miao
2011-10-01 20:03 ` [PATCH 06/26] ARM: pxa: add missing header inclusions Arnd Bergmann
2011-10-07  5:08   ` Eric Miao
2011-10-08  8:03     ` Russell King - ARM Linux
2011-10-08 10:23       ` Jamie Iles
2011-10-08 10:24         ` Eric Miao
2011-10-01 20:03 ` [PATCH 07/26] ARM: pxa: mbxfb: disable broken debugfs code Arnd Bergmann
2011-10-07  5:10   ` Eric Miao
2011-10-01 20:03 ` [PATCH 08/26] ARM: pxa: move z2 to generic cpu_suspend Arnd Bergmann
2011-10-07  5:59   ` Eric Miao
2011-10-07  9:56     ` Arnd Bergmann
2011-10-08 12:37       ` Eric Miao
2011-10-08 13:00         ` Arnd Bergmann
2011-10-08 13:02           ` Eric Miao
2011-10-01 20:03 ` [PATCH 09/26] ARM: pxa: export symbols from pxa3xx-ulpi Arnd Bergmann
2011-10-07  6:01   ` Eric Miao
2011-10-01 20:03 ` [PATCH 10/26] ARM: pxa: allow selecting just one of TREO680/CENTRO Arnd Bergmann
2011-10-07  6:12   ` Eric Miao
2011-10-01 20:03 ` [PATCH 11/26] ARM: pxa: allow building palm27x without pxafb Arnd Bergmann
2011-10-07  6:19   ` Eric Miao
2011-10-07  9:57     ` Arnd Bergmann
2011-10-01 20:03 ` [PATCH 12/26] ARM: pxa: pxa95x/saarb depends on pxa3xx code Arnd Bergmann
2011-10-07  7:28   ` Eric Miao
2011-10-07  9:59     ` Arnd Bergmann
2011-10-01 20:03 ` [PATCH 13/26] ARM: pxa: use correct __iomem annotations Arnd Bergmann
2011-10-07  8:11   ` Eric Miao [this message]
2011-10-07  8:51     ` Russell King - ARM Linux
2011-10-07 10:16     ` Arnd Bergmann
2011-10-08 12:43       ` Eric Miao
2011-10-01 20:03 ` [PATCH 14/26] mtd: nand_h1900 never worked Arnd Bergmann
2011-10-07  8:21   ` Eric Miao
2011-10-16 11:38   ` Artem Bityutskiy
2011-10-01 20:03 ` [PATCH 15/26] irda/ficp: only works on some pxa models Arnd Bergmann
2011-10-07  8:22   ` Eric Miao
2011-10-01 20:03 ` [PATCH 16/26] ARM: pxa: CPU_PJ4 requires IWMMXT Arnd Bergmann
2011-10-02 16:03   ` Russell King - ARM Linux
2011-10-02 17:46     ` Arnd Bergmann
2011-10-04  0:59       ` Eric Miao
2011-10-04  7:33         ` Arnd Bergmann
2011-10-01 20:03 ` [PATCH 17/26] ARM: pxa: pxa95x is incompatible with earlier pxa Arnd Bergmann
2011-10-08  2:57   ` Haojian Zhuang
2011-10-08  3:21     ` Eric Miao
2011-10-08  3:32       ` Haojian Zhuang
2011-10-08 13:24         ` Arnd Bergmann
2011-10-09  6:21           ` Haojian Zhuang
2011-10-09  6:36             ` Eric Miao
2011-10-09  6:39               ` Haojian Zhuang
2011-10-09  7:28                 ` Eric Miao
2011-10-09 11:31               ` Arnd Bergmann
2011-10-09 11:35             ` Arnd Bergmann
2011-10-01 20:03 ` [PATCH 18/26] ARM: pxa: MTD_XIP is not actually working any more Arnd Bergmann
2011-10-08  7:44   ` Eric Miao
2011-10-08 17:36     ` Nicolas Pitre
2011-10-01 20:03 ` [PATCH 19/26] ARM: pxa: CPU_FREQ_TABLE is needed for CPU_FREQ Arnd Bergmann
2011-10-08  8:34   ` Eric Miao
2011-10-01 20:03 ` [PATCH 20/26] ARM: pxa: select FB_PXA on saar and tevorevb Arnd Bergmann
2011-10-08  9:50   ` Eric Miao
2011-10-08 10:07     ` Arnd Bergmann
2011-10-01 20:03 ` [PATCH 21/26] ARM: pxa: select POWER_SUPPLY on raumfeld Arnd Bergmann
2011-10-08  9:59   ` Eric Miao
2011-10-01 20:03 ` [PATCH 22/26] ARM: pxa: only select SMC91x on xcep when networking is enabled Arnd Bergmann
2011-10-08 10:10   ` Eric Miao
2011-10-01 20:03 ` [PATCH 23/26] ARM: pxa: viper: select I2C_GPIO only when I2C is on Arnd Bergmann
2011-10-01 20:03 ` [PATCH 24/26] ARM: pxa: centro and treo680 need palm27x Arnd Bergmann
2011-10-08 10:20   ` Eric Miao
2011-10-08 11:31     ` Marek Vasut
2011-10-01 20:03 ` [PATCH 25/26] ARM: pxa: eseries does not require FB Arnd Bergmann
2011-10-01 20:03 ` [PATCH 26/26] ARM: pxa: sharpsl pm needs SPI Arnd Bergmann
2011-10-08 10:22   ` Eric Miao

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=CAMPhdO_CGvoc8GZQS3TWpv0gqOXhmHyEbamcQr28K5iLgOBnuw@mail.gmail.com \
    --to=eric.y.miao@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).