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

login
register
mail settings
Submitter Haojian Zhuang
Date Nov. 8, 2011, 10:24 a.m.
Message ID <1320747859-8366-2-git-send-email-haojian.zhuang@marvell.com>
Download mbox | patch
Permalink /patch/124314/
State New
Headers show

Comments

Haojian Zhuang - Nov. 8, 2011, 10:24 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(-)
Jason Liu - Nov. 8, 2011, 11:19 a.m.
2011/11/8 Haojian Zhuang <haojian.zhuang@marvell.com>:
> 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(-)
>

It seems that this is pxa related fix, why not have pxa keyword in the
commit log
which will make the patch filter life easier.

Jason Liu

>
> --
> 1.7.4.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
Haojian Zhuang - Nov. 8, 2011, 1:09 p.m.
On Tue, Nov 8, 2011 at 7:19 PM, Jason Liu <liu.h.jason@gmail.com> wrote:
> 2011/11/8 Haojian Zhuang <haojian.zhuang@marvell.com>:
>> 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(-)
>>
>
> It seems that this is pxa related fix, why not have pxa keyword in the
> commit log
> which will make the patch filter life easier.
>
> Jason Liu
>

Because this issue is caused by incorrect macro definition in arch-mmp.
Both arch-pxa and arch-mmp is sharing plat-pxa.

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