Fix assert in bakery_lock_release()
authorJon Medhurst <tixy@linaro.org>
Thu, 6 Feb 2014 14:13:16 +0000 (14:13 +0000)
committerDan Handley <dan.handley@arm.com>
Wed, 5 Mar 2014 16:21:14 +0000 (16:21 +0000)
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>
include/bakery_lock.h
lib/sync/locks/bakery/bakery_lock.c

index 96153bc192c3cf9fd86b726d7e695c253b1310f2..c7ff903f0c31def5ae059cfb91db85d1876fb4b1 100644 (file)
@@ -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);
index 964124824ecb0178726378c1d23e0fd233544af5..444b6a188d65935f1a94c0f1d68ca509d0ff13db 100644 (file)
@@ -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;
-}