object tracing: Fix the issue that objects lost from trace list
Add a flag for identifing whether this object is on the trace list. Ensure that link any object to the trace list only one time. It will avoid the issue about lost object caused by adding a object to trace list twice. Fixes #19537 Signed-off-by: Shih-Wei Teng <swteng@andestech.com>
This commit is contained in:
parent
13120f7313
commit
5ebceeb8cb
2 changed files with 26 additions and 10 deletions
|
@ -33,15 +33,18 @@
|
|||
* @param name Name of the trace list.
|
||||
* @param obj Object to be added in the trace list.
|
||||
*/
|
||||
#define SYS_TRACING_OBJ_INIT(name, obj) \
|
||||
do { \
|
||||
unsigned int key; \
|
||||
\
|
||||
key = irq_lock(); \
|
||||
(obj)->__next = _trace_list_ ## name; \
|
||||
_trace_list_ ## name = obj; \
|
||||
irq_unlock(key); \
|
||||
} \
|
||||
#define SYS_TRACING_OBJ_INIT(name, obj) \
|
||||
do { \
|
||||
unsigned int key; \
|
||||
\
|
||||
key = irq_lock(); \
|
||||
if (!(obj)->__linked) { \
|
||||
(obj)->__next = _trace_list_ ## name; \
|
||||
_trace_list_ ## name = obj; \
|
||||
(obj)->__linked = 1; \
|
||||
} \
|
||||
irq_unlock(key); \
|
||||
} \
|
||||
while (false)
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue