aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2014-02-06 14:13:16 +0000
committerJon Medhurst <tixy@linaro.org>2014-02-27 11:19:41 +0000
commit414287c18d7e885ae348f8d50a8f912b81aa9c3e (patch)
tree6fe741a7ca53e49abb148ac50ba0b7d73a8b322f
parente3fff153803bcf256d95e5b4d31a0c04d50ed5e4 (diff)
Fix assert in bakery_lock_release()tixy-issue-27
bakery_lock_release() expects an mpidr as the first argument however bakery_lock_release() is calling it with the 'entry' argument it has calculated. Rather than fixing this to pass the mpidr value it would be much more efficient to just replace the call with assert(bakery->owner == entry) As this leaves no remaining users of bakery_lock_held(), we might as well delete it. Fixes ARM-software/tf-issues#27 Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r--include/bakery_lock.h2
-rw-r--r--lib/sync/locks/bakery/bakery_lock.c11
2 files changed, 1 insertions, 12 deletions
diff --git a/include/bakery_lock.h b/include/bakery_lock.h
index 96153bc..c7ff903 100644
--- a/include/bakery_lock.h
+++ b/include/bakery_lock.h
@@ -45,8 +45,6 @@ typedef struct {
#define NO_OWNER (-1)
void bakery_lock_init(bakery_lock* bakery);
-/* Check whether a lock is held. Mainly used for debug purpose. */
-int bakery_lock_held(unsigned long mpidr, const bakery_lock * bakery);
void bakery_lock_get(unsigned long mpidr, bakery_lock* bakery);
void bakery_lock_release(unsigned long mpidr, bakery_lock* bakery);
int bakery_lock_try(unsigned long mpidr, bakery_lock* bakery);
diff --git a/lib/sync/locks/bakery/bakery_lock.c b/lib/sync/locks/bakery/bakery_lock.c
index 9641248..444b6a1 100644
--- a/lib/sync/locks/bakery/bakery_lock.c
+++ b/lib/sync/locks/bakery/bakery_lock.c
@@ -88,17 +88,8 @@ void bakery_lock_release(unsigned long mpidr, bakery_lock * bakery)
unsigned int entry = platform_get_core_pos(mpidr);
assert_bakery_entry_valid(entry, bakery);
- assert(bakery_lock_held(entry, bakery));
+ assert(bakery->owner == entry);
bakery->owner = NO_OWNER;
bakery->number[entry] = 0;
}
-
-int bakery_lock_held(unsigned long mpidr, const bakery_lock * bakery)
-{
- unsigned int entry = platform_get_core_pos(mpidr);
-
- assert_bakery_entry_valid(entry, bakery);
-
- return bakery->owner == entry;
-}