From 095b9a255a44410f841cd556e480e91443117955 Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Tue, 7 Jul 2026 15:32:41 +0800 Subject: [PATCH] fix(esp_phy): use early log macros in ISR context to avoid log lock deadlock --- components/esp_phy/src/lib_printf.c | 9 +++++++-- components/esp_phy/src/phy_common.c | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/components/esp_phy/src/lib_printf.c b/components/esp_phy/src/lib_printf.c index 4a97ae2bae2..1d1961c34af 100644 --- a/components/esp_phy/src/lib_printf.c +++ b/components/esp_phy/src/lib_printf.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2016-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2016-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -18,6 +18,7 @@ #include #include +#include "freertos/FreeRTOS.h" #include "esp_log.h" #include "esp_attr.h" @@ -36,7 +37,11 @@ static int lib_printf(const char* tag, const char* format, va_list arg) temp[i] = 0; } if (i > 0) { - ESP_LOGI(tag, "%s", temp); + if (xPortInIsrContext()) { + ESP_EARLY_LOGI(tag, "%s", temp); + } else { + ESP_LOGI(tag, "%s", temp); + } } va_end(arg); return len; diff --git a/components/esp_phy/src/phy_common.c b/components/esp_phy/src/phy_common.c index 17b77825d2a..86c66bb5b01 100644 --- a/components/esp_phy/src/phy_common.c +++ b/components/esp_phy/src/phy_common.c @@ -17,6 +17,7 @@ #include "esp_private/phy.h" #include "esp_phy.h" #include "esp_attr.h" +#include "freertos/FreeRTOS.h" #if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP #include "hal/temperature_sensor_ll.h" @@ -388,6 +389,10 @@ void phy_wakeup_from_modem_state_extra_init(void) __attribute__((weak)) void phy_wait_freq_hw_hop_done(void) { - ESP_LOGD(TAG, "phy_wait_freq_hw_hop_done is not implemented"); + if (xPortInIsrContext()) { + ESP_EARLY_LOGD(TAG, "phy_wait_freq_hw_hop_done is not implemented"); + } else { + ESP_LOGD(TAG, "phy_wait_freq_hw_hop_done is not implemented"); + } return; }