Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 5633372

Browse files
committed
[callbacks] Eliminate compile warning (#1802)
Fixes #1801 Signed-off-by: Geoff Gustafson <[email protected]>
1 parent 4cf09c5 commit 5633372

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/zjs_callbacks.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ static u8_t ring_buf_initialized = 1;
9696

9797
#ifdef ZJS_LINUX_BUILD
9898
#define k_is_preempt_thread() 0
99-
#define irq_lock() 0
100-
#define irq_unlock(key) do {} while (0);
10199
#define RB_LOCK() do {} while (0)
102100
#define RB_UNLOCK() do {} while (0)
103101
#define CB_LOCK() do {} while (0)
@@ -397,7 +395,9 @@ void signal_callback_priv(zjs_callback_id id,
397395
args, size);
398396
#endif
399397
int in_thread = k_is_preempt_thread(); // versus ISR or co-op thread
398+
#ifndef ZJS_LINUX_BUILD
400399
int key = 0;
400+
#endif
401401
if (in_thread) CB_LOCK();
402402
if (id < 0 || id >= cb_size || !cb_map[id]) {
403403
DBG_PRINT("callback ID %d does not exist\n", id);
@@ -420,10 +420,12 @@ void signal_callback_priv(zjs_callback_id id,
420420
#ifdef INSTRUMENT_CALLBACKS
421421
set_info_string(cb_map[id]->caller, file, func);
422422
#endif
423+
#ifndef ZJS_LINUX_BUILD
423424
if (in_thread) {
424425
RB_LOCK();
425426
key = irq_lock();
426427
}
428+
#endif
427429
int ret = zjs_port_ring_buf_put(&ring_buffer,
428430
(u16_t)id,
429431
0, // we use value for CB_FLUSH_ONE/ALL
@@ -434,11 +436,11 @@ void signal_callback_priv(zjs_callback_id id,
434436
// rather than locking everything, as we are only trying to prevent a
435437
// callback
436438
// from being edited and called at the same time.
439+
#ifndef ZJS_LINUX_BUILD
437440
if (in_thread) {
438441
irq_unlock(key);
439442
RB_UNLOCK();
440443
}
441-
#ifndef ZJS_LINUX_BUILD
442444
zjs_loop_unblock();
443445
#endif
444446
if (ret != 0) {

0 commit comments

Comments
 (0)