Patchwork [v7,01/11] ARM: mmp: fix build error on gpio

login
register
mail settings
Submitter Haojian Zhuang
Date Nov. 9, 2011, 2:47 a.m.
Message ID <1320806851-13928-2-git-send-email-haojian.zhuang@marvell.com>
Download mbox | patch
Permalink /patch/124471/
State New
Headers show

Comments

Haojian Zhuang - Nov. 9, 2011, 2:47 a.m.
Parameters of GPIO_REG() should be assigned as volatile.

arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_get_value’:
arch/arm/plat-pxa/include/plat/gpio.h:12:21: error: invalid operands to
binary & (have ‘void *’ and ‘int’)
arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_set_value’:
arch/arm/plat-pxa/include/plat/gpio.h:21:4: error: lvalue required as
left operand of assignment
arch/arm/plat-pxa/include/plat/gpio.h:23:4: error: lvalue required as
left operand of assignment

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
 arch/arm/mach-mmp/include/mach/gpio-pxa.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Eric Miao - Nov. 14, 2011, 5:34 a.m.
On Wed, Nov 9, 2011 at 10:47 AM, Haojian Zhuang
<haojian.zhuang@marvell.com> wrote:
> Parameters of GPIO_REG() should be assigned as volatile.
>
> arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_get_value’:
> arch/arm/plat-pxa/include/plat/gpio.h:12:21: error: invalid operands to
> binary & (have ‘void *’ and ‘int’)
> arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_set_value’:
> arch/arm/plat-pxa/include/plat/gpio.h:21:4: error: lvalue required as
> left operand of assignment
> arch/arm/plat-pxa/include/plat/gpio.h:23:4: error: lvalue required as
> left operand of assignment
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>

Applied.

> ---
>  arch/arm/mach-mmp/include/mach/gpio-pxa.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
> index d14eeaf..99b4ce1 100644
> --- a/arch/arm/mach-mmp/include/mach/gpio-pxa.h
> +++ b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
> @@ -7,7 +7,7 @@
>  #define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
>
>  #define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
> -#define GPIO_REG(x)    (GPIO_REGS_VIRT + (x))
> +#define GPIO_REG(x)    (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
>
>  #define NR_BUILTIN_GPIO                IRQ_GPIO_NUM
>
> --
> 1.7.4.1
>
>
Arnd Bergmann - Nov. 17, 2011, 3:16 p.m.
On Wednesday 09 November 2011, Haojian Zhuang wrote:
> Parameters of GPIO_REG() should be assigned as volatile.
> 
> arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_get_value’:
> arch/arm/plat-pxa/include/plat/gpio.h:12:21: error: invalid operands to
> binary & (have ‘void *’ and ‘int’)
> arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_set_value’:
> arch/arm/plat-pxa/include/plat/gpio.h:21:4: error: lvalue required as
> left operand of assignment
> arch/arm/plat-pxa/include/plat/gpio.h:23:4: error: lvalue required as
> left operand of assignment
> 
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
>  arch/arm/mach-mmp/include/mach/gpio-pxa.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
> index d14eeaf..99b4ce1 100644
> --- a/arch/arm/mach-mmp/include/mach/gpio-pxa.h
> +++ b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
> @@ -7,7 +7,7 @@
>  #define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
>  
>  #define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
> -#define GPIO_REG(x)    (GPIO_REGS_VIRT + (x))
> +#define GPIO_REG(x)    (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
>  
>  #define NR_BUILTIN_GPIO                IRQ_GPIO_NUM

Note that this is not the correct fix, it just restores the previous
state after I broke the original code in an "evil" merge commit
that tried to merge the gpio branch with my patch that changed the
mmio annotations.

Anyway, everything seems fine now, since patch 9/11 removes the code
either way.

	Arnd
Eric Miao - Nov. 17, 2011, 3:33 p.m.
On Thu, Nov 17, 2011 at 11:16 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Wednesday 09 November 2011, Haojian Zhuang wrote:
>> Parameters of GPIO_REG() should be assigned as volatile.
>>
>> arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_get_value’:
>> arch/arm/plat-pxa/include/plat/gpio.h:12:21: error: invalid operands to
>> binary & (have ‘void *’ and ‘int’)
>> arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_set_value’:
>> arch/arm/plat-pxa/include/plat/gpio.h:21:4: error: lvalue required as
>> left operand of assignment
>> arch/arm/plat-pxa/include/plat/gpio.h:23:4: error: lvalue required as
>> left operand of assignment
>>
>> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
>> ---
>>  arch/arm/mach-mmp/include/mach/gpio-pxa.h |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
>> index d14eeaf..99b4ce1 100644
>> --- a/arch/arm/mach-mmp/include/mach/gpio-pxa.h
>> +++ b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
>> @@ -7,7 +7,7 @@
>>  #define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
>>
>>  #define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
>> -#define GPIO_REG(x)    (GPIO_REGS_VIRT + (x))
>> +#define GPIO_REG(x)    (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
>>
>>  #define NR_BUILTIN_GPIO                IRQ_GPIO_NUM
>
> Note that this is not the correct fix, it just restores the previous
> state after I broke the original code in an "evil" merge commit
> that tried to merge the gpio branch with my patch that changed the
> mmio annotations.
>
> Anyway, everything seems fine now, since patch 9/11 removes the code
> either way.

Yeah, but having a patch here really helps to make a buildable
state of the history.

Shall I go ahead and send the GIT PULL with this patch? or you have
another idea?
Arnd Bergmann - Nov. 17, 2011, 5 p.m.
On Thursday 17 November 2011, Eric Miao wrote:
> On Thu, Nov 17, 2011 at 11:16 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Wednesday 09 November 2011, Haojian Zhuang wrote:
> >> Parameters of GPIO_REG() should be assigned as volatile.
> >>
> >> arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_get_value’:
> >> arch/arm/plat-pxa/include/plat/gpio.h:12:21: error: invalid operands to
> >> binary & (have ‘void *’ and ‘int’)
> >> arch/arm/plat-pxa/include/plat/gpio.h: In function ‘gpio_set_value’:
> >> arch/arm/plat-pxa/include/plat/gpio.h:21:4: error: lvalue required as
> >> left operand of assignment
> >> arch/arm/plat-pxa/include/plat/gpio.h:23:4: error: lvalue required as
> >> left operand of assignment
> >>
> >> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> >> ---
> >>  arch/arm/mach-mmp/include/mach/gpio-pxa.h |    2 +-
> >>  1 files changed, 1 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
> >> index d14eeaf..99b4ce1 100644
> >> --- a/arch/arm/mach-mmp/include/mach/gpio-pxa.h
> >> +++ b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
> >> @@ -7,7 +7,7 @@
> >>  #define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
> >>
> >>  #define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
> >> -#define GPIO_REG(x)    (GPIO_REGS_VIRT + (x))
> >> +#define GPIO_REG(x)    (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
> >>
> >>  #define NR_BUILTIN_GPIO                IRQ_GPIO_NUM
> >
> > Note that this is not the correct fix, it just restores the previous
> > state after I broke the original code in an "evil" merge commit
> > that tried to merge the gpio branch with my patch that changed the
> > mmio annotations.
> >
> > Anyway, everything seems fine now, since patch 9/11 removes the code
> > either way.
> 
> Yeah, but having a patch here really helps to make a buildable
> state of the history.
> 
> Shall I go ahead and send the GIT PULL with this patch? or you have
> another idea?

Actually it turns out that Russell has already sent an identical
fix upstream, and that has made it into 3.2-rc1, so I think it should
be fine now without your patch.

	Arnd
Russell King - ARM Linux - Nov. 17, 2011, 5:04 p.m.
On Thu, Nov 17, 2011 at 05:00:59PM +0000, Arnd Bergmann wrote:
> On Thursday 17 November 2011, Eric Miao wrote:
> > Yeah, but having a patch here really helps to make a buildable
> > state of the history.
> > 
> > Shall I go ahead and send the GIT PULL with this patch? or you have
> > another idea?
> 
> Actually it turns out that Russell has already sent an identical
> fix upstream, and that has made it into 3.2-rc1, so I think it should
> be fine now without your patch.

I sent one for PXA for rc1, but missed MMP.  So the MMP one is still
required.

Patch

diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
index d14eeaf..99b4ce1 100644
--- a/arch/arm/mach-mmp/include/mach/gpio-pxa.h
+++ b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
@@ -7,7 +7,7 @@ 
 #define GPIO_REGS_VIRT	(APB_VIRT_BASE + 0x19000)
 
 #define BANK_OFF(n)	(((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
-#define GPIO_REG(x)	(GPIO_REGS_VIRT + (x))
+#define GPIO_REG(x)	(*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
 
 #define NR_BUILTIN_GPIO		IRQ_GPIO_NUM