arm: common: fix cpaccess asm instruction
The write_val argument was not specified as an input
on the asm instruction. The compiler thought it wasn't used,
even though the asm instruction does use r0, which
is how write_val is passed into the function. The compiler
would optimise out the argument being passed into
the function.
Add write_val as an input operand to prevent it being
optimised out.
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
(cherry picked from commit e1bb10a173de0327171c2c8d16f64af34a5ca937)
Change-Id: I478f79a1a34a4ee15516a1765f8c6094191454fd
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
diff --git a/arch/arm/common/cpaccess.c b/arch/arm/common/cpaccess.c
index 12e2c38..85cd09f 100644
--- a/arch/arm/common/cpaccess.c
+++ b/arch/arm/common/cpaccess.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -149,7 +149,8 @@
asm volatile (".globl cpaccess_dummy_inst\n"
"cpaccess_dummy_inst:\n\t"
- "mrc p15, 0, %0, c0, c0, 0\n\t" : "=r" (ret));
+ "mrc p15, 0, %0, c0, c0, 0\n\t" : "=r" (ret) :
+ "r" (write_val));
return ret;
} __attribute__((aligned(32)))