diff options
-rw-r--r-- | firmware/export/kernel.h | 4 | ||||
-rw-r--r-- | firmware/kernel.c | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index c4d661f213..a4761302e0 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h | |||
@@ -150,7 +150,7 @@ struct mutex | |||
150 | struct thread_entry *thread; | 150 | struct thread_entry *thread; |
151 | #endif | 151 | #endif |
152 | IF_COP( struct corelock cl; ) /* multiprocessor sync */ | 152 | IF_COP( struct corelock cl; ) /* multiprocessor sync */ |
153 | unsigned char locked; /* locked semaphore */ | 153 | bool locked; /* locked semaphore */ |
154 | }; | 154 | }; |
155 | 155 | ||
156 | #ifdef HAVE_SEMAPHORE_OBJECTS | 156 | #ifdef HAVE_SEMAPHORE_OBJECTS |
@@ -167,7 +167,7 @@ struct semaphore | |||
167 | struct wakeup | 167 | struct wakeup |
168 | { | 168 | { |
169 | struct thread_entry *queue; /* waiter list */ | 169 | struct thread_entry *queue; /* waiter list */ |
170 | unsigned char signalled; /* signalled status */ | 170 | bool signalled; /* signalled status */ |
171 | IF_COP( struct corelock cl; ) /* multiprocessor sync */ | 171 | IF_COP( struct corelock cl; ) /* multiprocessor sync */ |
172 | }; | 172 | }; |
173 | #endif | 173 | #endif |
diff --git a/firmware/kernel.c b/firmware/kernel.c index d7076c935f..64c8142540 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c | |||
@@ -892,7 +892,7 @@ void mutex_init(struct mutex *m) | |||
892 | corelock_init(&m->cl); | 892 | corelock_init(&m->cl); |
893 | m->queue = NULL; | 893 | m->queue = NULL; |
894 | m->count = 0; | 894 | m->count = 0; |
895 | m->locked = 0; | 895 | m->locked = false; |
896 | mutex_set_thread(m, NULL); | 896 | mutex_set_thread(m, NULL); |
897 | #ifdef HAVE_PRIORITY_SCHEDULING | 897 | #ifdef HAVE_PRIORITY_SCHEDULING |
898 | m->blocker.priority = PRIORITY_IDLE; | 898 | m->blocker.priority = PRIORITY_IDLE; |
@@ -916,11 +916,11 @@ void mutex_lock(struct mutex *m) | |||
916 | /* lock out other cores */ | 916 | /* lock out other cores */ |
917 | corelock_lock(&m->cl); | 917 | corelock_lock(&m->cl); |
918 | 918 | ||
919 | if(LIKELY(m->locked == 0)) | 919 | if(LIKELY(!m->locked)) |
920 | { | 920 | { |
921 | /* lock is open */ | 921 | /* lock is open */ |
922 | mutex_set_thread(m, current); | 922 | mutex_set_thread(m, current); |
923 | m->locked = 1; | 923 | m->locked = true; |
924 | corelock_unlock(&m->cl); | 924 | corelock_unlock(&m->cl); |
925 | return; | 925 | return; |
926 | } | 926 | } |
@@ -963,7 +963,7 @@ void mutex_unlock(struct mutex *m) | |||
963 | { | 963 | { |
964 | /* no threads waiting - open the lock */ | 964 | /* no threads waiting - open the lock */ |
965 | mutex_set_thread(m, NULL); | 965 | mutex_set_thread(m, NULL); |
966 | m->locked = 0; | 966 | m->locked = false; |
967 | corelock_unlock(&m->cl); | 967 | corelock_unlock(&m->cl); |
968 | return; | 968 | return; |
969 | } | 969 | } |
@@ -1062,7 +1062,7 @@ void semaphore_release(struct semaphore *s) | |||
1062 | void wakeup_init(struct wakeup *w) | 1062 | void wakeup_init(struct wakeup *w) |
1063 | { | 1063 | { |
1064 | w->queue = NULL; | 1064 | w->queue = NULL; |
1065 | w->signalled = 0; | 1065 | w->signalled = false; |
1066 | IF_COP( corelock_init(&w->cl); ) | 1066 | IF_COP( corelock_init(&w->cl); ) |
1067 | } | 1067 | } |
1068 | 1068 | ||
@@ -1074,7 +1074,7 @@ int wakeup_wait(struct wakeup *w, int timeout) | |||
1074 | 1074 | ||
1075 | corelock_lock(&w->cl); | 1075 | corelock_lock(&w->cl); |
1076 | 1076 | ||
1077 | if(LIKELY(w->signalled == 0 && timeout != TIMEOUT_NOBLOCK)) | 1077 | if(LIKELY(!w->signalled && timeout != TIMEOUT_NOBLOCK)) |
1078 | { | 1078 | { |
1079 | struct thread_entry * current = thread_id_entry(THREAD_ID_CURRENT); | 1079 | struct thread_entry * current = thread_id_entry(THREAD_ID_CURRENT); |
1080 | 1080 | ||
@@ -1093,14 +1093,14 @@ int wakeup_wait(struct wakeup *w, int timeout) | |||
1093 | corelock_lock(&w->cl); | 1093 | corelock_lock(&w->cl); |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | if(UNLIKELY(w->signalled == 0)) | 1096 | if(UNLIKELY(!w->signalled)) |
1097 | { | 1097 | { |
1098 | /* Timed-out or failed */ | 1098 | /* Timed-out or failed */ |
1099 | ret = (timeout != TIMEOUT_BLOCK) ? | 1099 | ret = (timeout != TIMEOUT_BLOCK) ? |
1100 | OBJ_WAIT_TIMEDOUT : OBJ_WAIT_FAILED; | 1100 | OBJ_WAIT_TIMEDOUT : OBJ_WAIT_FAILED; |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | w->signalled = 0; /* Reset */ | 1103 | w->signalled = false; /* Reset */ |
1104 | 1104 | ||
1105 | corelock_unlock(&w->cl); | 1105 | corelock_unlock(&w->cl); |
1106 | restore_irq(oldlevel); | 1106 | restore_irq(oldlevel); |
@@ -1120,7 +1120,7 @@ int wakeup_signal(struct wakeup *w) | |||
1120 | 1120 | ||
1121 | corelock_lock(&w->cl); | 1121 | corelock_lock(&w->cl); |
1122 | 1122 | ||
1123 | w->signalled = 1; | 1123 | w->signalled = true; |
1124 | ret = wakeup_thread(&w->queue); | 1124 | ret = wakeup_thread(&w->queue); |
1125 | 1125 | ||
1126 | corelock_unlock(&w->cl); | 1126 | corelock_unlock(&w->cl); |