device: Make device_sync_call_complete aware of the caller context
device_sync_call_complete can be called from ISR, fiber or task, thus needs to be aware not only of the waiter context, but also on the actual caller one. Change-Id: I76652a2c44d854db9c34e7192355d455d43f61e3 Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
This commit is contained in:
parent
f0a1d22f28
commit
9183e1f4de
1 changed files with 8 additions and 3 deletions
|
@ -231,10 +231,15 @@ static inline void device_sync_call_wait(device_sync_call_t *sync)
|
||||||
*/
|
*/
|
||||||
static inline void device_sync_call_complete(device_sync_call_t *sync)
|
static inline void device_sync_call_complete(device_sync_call_t *sync)
|
||||||
{
|
{
|
||||||
|
static void (*func[3])(ksem_t sema) = {
|
||||||
|
isr_sem_give,
|
||||||
|
fiber_sem_give,
|
||||||
|
task_sem_give
|
||||||
|
};
|
||||||
if (sync->waiter_is_task) {
|
if (sync->waiter_is_task) {
|
||||||
task_sem_give(sync->t_sem);
|
func[sys_execution_context_type_get()](sync->t_sem);
|
||||||
} else {
|
} else {
|
||||||
nano_isr_sem_give(&sync->f_sem);
|
nano_sem_give(&sync->f_sem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +264,7 @@ static inline void device_sync_call_wait(device_sync_call_t *sync)
|
||||||
*/
|
*/
|
||||||
static inline void device_sync_call_complete(device_sync_call_t *sync)
|
static inline void device_sync_call_complete(device_sync_call_t *sync)
|
||||||
{
|
{
|
||||||
nano_isr_sem_give(&sync->f_sem);
|
nano_sem_give(&sync->f_sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_MICROKERNEL || CONFIG_NANOKERNEL */
|
#endif /* CONFIG_MICROKERNEL || CONFIG_NANOKERNEL */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue