diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-03-23 12:15:16 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-03-23 12:15:16 +0100 |
commit | ac7267ac2580590a9253549d8e129c853b6b30c7 (patch) | |
tree | 9425e0d8cfff345312da3af7e963715e776de039 /include/slice.h | |
parent | f4d9908504e2a35afc4f39da6aa3436903039121 (diff) | |
parent | 412806653a147177cba75fb62ea633d74c5ad1ee (diff) | |
download | barebox-ac7267ac2580590a9253549d8e129c853b6b30c7.tar.gz |
Merge branch 'for-next/bthreads'
Diffstat (limited to 'include/slice.h')
-rw-r--r-- | include/slice.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/slice.h b/include/slice.h index b2d65b80cd..cf684300a8 100644 --- a/include/slice.h +++ b/include/slice.h @@ -1,6 +1,8 @@ #ifndef __SLICE_H #define __SLICE_H +#include <bthread.h> + enum slice_action { SLICE_ACQUIRE = 1, SLICE_RELEASE = -1, @@ -35,12 +37,11 @@ void command_slice_release(void); extern int poller_active; -#ifdef CONFIG_POLLER -#define assert_command_context() ({ \ - WARN_ONCE(poller_active, "%s called in poller\n", __func__); \ -}) -#else -#define assert_command_context() do { } while (0) -#endif +#define assert_command_context() do { \ + WARN_ONCE(IS_ENABLED(CONFIG_POLLER) && poller_active, \ + "%s called in poller\n", __func__); \ + WARN_ONCE(IS_ENABLED(CONFIG_BTHREAD) && !bthread_is_main(current), \ + "%s called in secondary bthread\n", __func__); \ +} while (0) -#endif /* __SLICE_H */ +#endif |