rmobile: kzm9g: Fix warnin in cmp_loop function
PATCH 1/1 rmobile: kzm9g: Fix warnin in cmp_loop function
cmp_loop function was used from the structure of register. And for the member of this structure, volatile is defined. Since a volatile declaration of cmp_loop function is not made by argument, made warning by compiler. This fixes this problem.
--- board/kmc/kzm9g/kzm9g.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/kmc/kzm9g/kzm9g.c +1 -1
@@ -48,7 +48,7 @@ DECLARE_GLOBAL_DATA_PTR;#define PORT34CR (0xE6051022)#define PORT35CR (0xE6051023) -static int cmp_loop (u32 *addr,u32 data,u32 cmp) +static int cmp_loop (volatile u32 *addr,u32 data,u32 cmp) {int err =-1 ;int timeout =100 ;
Signature · 1 line
1.7.10
PATCH 1/1 rmobile: kzm9g: Fix warnin in cmp_loop function
Hi Nobuhiro,
Quoted 15 lines · Nobuhiro Iwamatsu
cmp_loopfunction was used from the structure of register. And for the member of this structure, volatile is defined. Since a volatile declaration ofcmp_loopfunction is not made by argument, made warning by compiler. This fixes this problem.Signed-off-by Nobuhiro Iwamatsu <[email protected]>--- board/kmc/kzm9g/kzm9g.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/kmc/kzm9g/kzm9g.c +0
-0
board/kmc/kzm9g/kzm9g.c DECLARE_GLOBAL_DATA_PTR; · line 54
Quoted 8 lines
board/kmc/kzm9g/kzm9g.c +1
-1@@ -48,7 +48,7 @@ DECLARE_GLOBAL_DATA_PTR;#define PORT34CR (0xE6051022)#define PORT35CR (0xE6051023) -static int cmp_loop (u32 *addr,u32 data,u32 cmp) +static int cmp_loop (volatile u32 *addr,u32 data,u32 cmp) {int err =-1 ;int timeout =100 ;
I doubt cmp_loop needs this change. Volatile qualifiers do not make much sense in anything other than actual read or write instructions; if cmp_loop needs any volatile, it's as casts in its body, not as qualifiers in its signature. Fix the compiler warning by casting the actual argument in the *call* to cmp_loop to non-volatile instead.
(incidentally, you should ask yourself why is the structure, or structure member, is qualified volatile in the first place; usually this is the sign that some code should instead use readl or writel and/or have isb() barriers at strategic places.)
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 rmobile: kzm9g: Fix warnin in cmp_loop function
Hi,
2012/7/6 Albert ARIBAUD <[email protected]>:
Quoted 34 lines
Hi Nobuhiro,
Quoted 15 lines · Nobuhiro Iwamatsu
cmp_loopfunction was used from the structure of register. And for the member of this structure, volatile is defined. Since a volatile declaration ofcmp_loopfunction is not made by argument, made warning by compiler. This fixes this problem.Signed-off-by Nobuhiro Iwamatsu <[email protected]>--- board/kmc/kzm9g/kzm9g.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/kmc/kzm9g/kzm9g.c +0
-0board/kmc/kzm9g/kzm9g.c DECLARE_GLOBAL_DATA_PTR; · line 54
Quoted 8 lines
board/kmc/kzm9g/kzm9g.c +1
-1@@ -48,7 +48,7 @@ DECLARE_GLOBAL_DATA_PTR;#define PORT34CR (0xE6051022)#define PORT35CR (0xE6051023) -static int cmp_loop (u32 *addr,u32 data,u32 cmp) +static int cmp_loop (volatile u32 *addr,u32 data,u32 cmp) {int err =-1 ;int timeout =100 ;I doubt
cmp_loopneeds this change. Volatile qualifiers do not make much sense in anything other than actual read or write instructions; ifcmp_loopneeds any volatile, it's as casts in its body, not as qualifiers in its signature. Fix the compiler warning by casting the actual argument in the *call* tocmp_loopto non-volatile instead.
Quoted 5 lines
(incidentally, you should ask yourself why is the structure, or structure member, is qualified volatile in the first place; usually this is the sign that some code should instead use readl or writel and/or have
isb()barriers at strategic places.)
Thank you for your comment.
You are right. I will fix structure member.
Best regards,
Nobuhiro
Signature · 3 lines
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6