summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorShell <[email protected]>2024-04-09 21:36:16 +0800
committerRbb666 <[email protected]>2024-04-19 15:29:16 +0800
commita79176b0ae4938518fe2ac511d280522519a6244 (patch)
tree89b6922487686e1fabd8db7893aee10b9515bf01 /include
parent0655742ccf5027f74f3dd99d4987ad1af30097f5 (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')
-rw-r--r--include/rtdef.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/include/rtdef.h b/include/rtdef.h
index abd4a95639..e524800f43 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -526,23 +526,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, \