summaryrefslogtreecommitdiff
path: root/firmware/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/kernel')
-rw-r--r--firmware/kernel/include/mutex.h11
-rw-r--r--firmware/kernel/mutex.c5
2 files changed, 2 insertions, 14 deletions
diff --git a/firmware/kernel/include/mutex.h b/firmware/kernel/include/mutex.h
index b74bfe23f5..4778eb7f11 100644
--- a/firmware/kernel/include/mutex.h
+++ b/firmware/kernel/include/mutex.h
@@ -31,21 +31,12 @@ struct mutex
31 struct blocker blocker; /* priority inheritance info 31 struct blocker blocker; /* priority inheritance info
32 for waiters and owner*/ 32 for waiters and owner*/
33 IF_COP( struct corelock cl; ) /* multiprocessor sync */ 33 IF_COP( struct corelock cl; ) /* multiprocessor sync */
34#ifdef HAVE_PRIORITY_SCHEDULING
35 bool no_preempt;
36#endif
37}; 34};
38 35
39extern void mutex_init(struct mutex *m); 36extern void mutex_init(struct mutex *m);
40extern void mutex_lock(struct mutex *m); 37extern void mutex_lock(struct mutex *m);
41extern void mutex_unlock(struct mutex *m); 38extern void mutex_unlock(struct mutex *m);
42#ifdef HAVE_PRIORITY_SCHEDULING 39#ifndef HAVE_PRIORITY_SCHEDULING
43/* Deprecated temporary function to disable mutex preempting a thread on
44 * unlock - firmware/drivers/fat.c and a couple places in apps/buffering.c -
45 * reliance on it is a bug! */
46static inline void mutex_set_preempt(struct mutex *m, bool preempt)
47 { m->no_preempt = !preempt; }
48#else
49/* Deprecated but needed for now - firmware/drivers/ata_mmc.c */ 40/* Deprecated but needed for now - firmware/drivers/ata_mmc.c */
50static inline bool mutex_test(const struct mutex *m) 41static inline bool mutex_test(const struct mutex *m)
51 { return m->blocker.thread != NULL; } 42 { return m->blocker.thread != NULL; }
diff --git a/firmware/kernel/mutex.c b/firmware/kernel/mutex.c
index 876b704b51..cb9e6816b8 100644
--- a/firmware/kernel/mutex.c
+++ b/firmware/kernel/mutex.c
@@ -33,9 +33,6 @@ void mutex_init(struct mutex *m)
33 wait_queue_init(&m->queue); 33 wait_queue_init(&m->queue);
34 m->recursion = 0; 34 m->recursion = 0;
35 blocker_init(&m->blocker); 35 blocker_init(&m->blocker);
36#ifdef HAVE_PRIORITY_SCHEDULING
37 m->no_preempt = false;
38#endif
39 corelock_init(&m->cl); 36 corelock_init(&m->cl);
40} 37}
41 38
@@ -115,7 +112,7 @@ void mutex_unlock(struct mutex *m)
115 corelock_unlock(&m->cl); 112 corelock_unlock(&m->cl);
116 113
117#ifdef HAVE_PRIORITY_SCHEDULING 114#ifdef HAVE_PRIORITY_SCHEDULING
118 if((result & THREAD_SWITCH) && !m->no_preempt) 115 if(result & THREAD_SWITCH)
119 switch_thread(); 116 switch_thread();
120#endif 117#endif
121 (void)result; 118 (void)result;