Skip to content

Commit

Permalink
core: mutex: replace -1 with THREAD_ID_INVALID
Browse files Browse the repository at this point in the history
Code cleanup: use THREAD_ID_INVALID rather that its value (-1).

Signed-off-by: Jerome Forissier <[email protected]>
Reviewed-by: Etienne Carriere <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
  • Loading branch information
jforissier committed Jul 14, 2020
1 parent f86aa9e commit 3f7a0ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/arch/arm/kernel/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void mutex_init(struct mutex *m)
static void __mutex_lock(struct mutex *m, const char *fname, int lineno)
{
assert_have_no_spinlock();
assert(thread_get_id_may_fail() != -1);
assert(thread_get_id_may_fail() != THREAD_ID_INVALID);
assert(thread_is_in_normal_mode());

mutex_lock_check(m);
Expand Down Expand Up @@ -65,7 +65,7 @@ static void __mutex_unlock(struct mutex *m, const char *fname, int lineno)
uint32_t old_itr_status;

assert_have_no_spinlock();
assert(thread_get_id_may_fail() != -1);
assert(thread_get_id_may_fail() != THREAD_ID_INVALID);

mutex_unlock_check(m);

Expand All @@ -88,7 +88,7 @@ static bool __mutex_trylock(struct mutex *m, const char *fname __unused,
bool can_lock_write;

assert_have_no_spinlock();
assert(thread_get_id_may_fail() != -1);
assert(thread_get_id_may_fail() != THREAD_ID_INVALID);

old_itr_status = cpu_spin_lock_xsave(&m->spin_lock);

Expand All @@ -110,7 +110,7 @@ static void __mutex_read_unlock(struct mutex *m, const char *fname, int lineno)
short new_state;

assert_have_no_spinlock();
assert(thread_get_id_may_fail() != -1);
assert(thread_get_id_may_fail() != THREAD_ID_INVALID);

old_itr_status = cpu_spin_lock_xsave(&m->spin_lock);

Expand All @@ -129,7 +129,7 @@ static void __mutex_read_unlock(struct mutex *m, const char *fname, int lineno)
static void __mutex_read_lock(struct mutex *m, const char *fname, int lineno)
{
assert_have_no_spinlock();
assert(thread_get_id_may_fail() != -1);
assert(thread_get_id_may_fail() != THREAD_ID_INVALID);
assert(thread_is_in_normal_mode());

while (true) {
Expand Down Expand Up @@ -175,7 +175,7 @@ static bool __mutex_read_trylock(struct mutex *m, const char *fname __unused,
bool can_lock;

assert_have_no_spinlock();
assert(thread_get_id_may_fail() != -1);
assert(thread_get_id_may_fail() != THREAD_ID_INVALID);
assert(thread_is_in_normal_mode());

old_itr_status = cpu_spin_lock_xsave(&m->spin_lock);
Expand Down

0 comments on commit 3f7a0ba

Please sign in to comment.