summaryrefslogtreecommitdiff
path: root/include/rtdef.h
diff options
context:
space:
mode:
authorShell <[email protected]>2024-04-09 21:36:16 +0800
committerGitHub <[email protected]>2024-04-09 21:36:16 +0800
commit4b0f42c24aad9c824fb98a3bb4c7cc2fd29b632a (patch)
treeacbfb3c1ef799a4e1d48947d435f44e11fa4cbdd /include/rtdef.h
parent38204386b3c5db7412572adb75038badc4cef6d2 (diff)
[drivers/serial] Introduce hooker for TTY (#8733)
In this patch, a hook list has been introduced to address the concerns regarding coupling issues arising from modifications to the serial code for integrating TTY logic. Signed-off-by: Shell <[email protected]>
Diffstat (limited to 'include/rtdef.h')
-rw-r--r--include/rtdef.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/include/rtdef.h b/include/rtdef.h
index 085600433e..e3daa03828 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -525,23 +525,23 @@ struct rt_object_information
* do_other_things();
* }
*/
-#define _RT_OBJECT_HOOKLIST_CALL(nodetype, nested, list, lock, argv) \
- do \
- { \
- nodetype iter; \
- rt_ubase_t level = rt_spin_lock_irqsave(&lock); \
- nested += 1; \
- rt_spin_unlock_irqrestore(&lock, level); \
- if (!rt_list_isempty(&list)) \
- { \
- rt_list_for_each_entry(iter, &list, list_node) \
- { \
- iter->handler argv; \
- } \
- } \
- level = rt_spin_lock_irqsave(&lock); \
- nested -= 1; \
- rt_spin_unlock_irqrestore(&lock, level); \
+#define _RT_OBJECT_HOOKLIST_CALL(nodetype, nested, list, lock, argv) \
+ do \
+ { \
+ nodetype iter, next; \
+ rt_ubase_t level = rt_spin_lock_irqsave(&lock); \
+ nested += 1; \
+ rt_spin_unlock_irqrestore(&lock, level); \
+ if (!rt_list_isempty(&list)) \
+ { \
+ rt_list_for_each_entry_safe(iter, next, &list, list_node) \
+ { \
+ iter->handler argv; \
+ } \
+ } \
+ level = rt_spin_lock_irqsave(&lock); \
+ nested -= 1; \
+ rt_spin_unlock_irqrestore(&lock, level); \
} while (0)
#define RT_OBJECT_HOOKLIST_CALL(name, argv) \
_RT_OBJECT_HOOKLIST_CALL(name##_hooklistnode_t, name##_nested, \