summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Nash <enash54@gmail.com>2013-07-31 12:11:03 -0400
committerroshni.shah <roshni.shah@timesys.com>2014-01-04 19:33:23 -0500
commitcc86ebf7904fdd68944ea7a231b112714c10d441 (patch)
treeaaf404b8bf278b83711484cf19e45ba0638c70ad
parent61f3063ca289646c5cc3c0b22f24f8656191e5a4 (diff)
add a test call to determine state of semaphore without requesting it
-rw-r--r--arch/arm/mach-mvf/mvf_sema4.c10
-rw-r--r--include/linux/mvf_sema4.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/arm/mach-mvf/mvf_sema4.c b/arch/arm/mach-mvf/mvf_sema4.c
index 31e40f6d02f0..4521d124f1b7 100644
--- a/arch/arm/mach-mvf/mvf_sema4.c
+++ b/arch/arm/mach-mvf/mvf_sema4.c
@@ -286,3 +286,13 @@ int mvf_sema4_unlock(MVF_SEMA4 *sema4)
}
EXPORT_SYMBOL(mvf_sema4_unlock);
+// return 0 on success (meaning it is set to us)
+int mvf_sema4_test(MVF_SEMA4 *sema4)
+{
+ if(!sema4)
+ return -EINVAL;
+
+ return (readb(MVF_IO_ADDRESS(MVF_SEMA4_BASE_ADDR) + sema4->gate_num)) == LOCK_VALUE ? 0 : 1;
+}
+EXPORT_SYMBOL(mvf_sema4_test);
+
diff --git a/include/linux/mvf_sema4.h b/include/linux/mvf_sema4.h
index aa2379a9de05..198f3f249ec5 100644
--- a/include/linux/mvf_sema4.h
+++ b/include/linux/mvf_sema4.h
@@ -25,5 +25,6 @@ int mvf_sema4_assign(int gate_num, MVF_SEMA4** sema4_p);
int mvf_sema4_deassign(MVF_SEMA4 *sema4);
int mvf_sema4_lock(MVF_SEMA4 *sema4, unsigned int timeout_us, bool use_interrupts);
int mvf_sema4_unlock(MVF_SEMA4 *sema4);
+int mvf_sema4_test(MVF_SEMA4 *sema4);
#endif