Skip to content

Commit a27aa02

Browse files
esp-lisesp-wzh
authored andcommitted
fix(esp_hw_support): use iterator for regdma_link_stats to save stack consume
Closes espressif#13288
1 parent a641428 commit a27aa02

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

components/esp_hw_support/port/regdma_link.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,22 @@ static void regdma_link_update_stats_wrapper(void *link, int entry, int depth)
445445
regdma_link_update_stats(regdma_link_get_stats(link), entry, depth);
446446
}
447447

448+
static void regdma_link_iterator(void *link, int entry, void (*hook)(void *, int, int))
449+
{
450+
assert(entry < REGDMA_LINK_ENTRY_NUM);
451+
452+
int iter = 0;
453+
while (link) {
454+
if (hook) {
455+
(*hook)(link, entry, iter++);
456+
}
457+
link = regdma_link_get_next(link, entry);
458+
}
459+
}
460+
448461
void regdma_link_stats(void *link, int entry)
449462
{
450-
regdma_link_recursive_impl(link, entry, 0, regdma_link_update_stats_wrapper);
463+
regdma_link_iterator(link, entry, regdma_link_update_stats_wrapper);
451464
}
452465

453466
static void regdma_link_destroy_wrapper(void *link, int entry, int depth)

0 commit comments

Comments
 (0)