Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions arch/xtensa/src/common/espressif/esp_wifi_event_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,20 @@ static void esp_wifi_event_handler(void *arg, esp_event_base_t event_base,
UNUSED(event_base);

net_lock();
esp_wifi_lock(true);

/* esp_wifi_lock() no longer spans the esp_wlan_*_hook() calls below:
* they take netdev_lock(), which ifdown already holds *around* its own
* esp_wifi_lock() call, so locking both here in the opposite order
* deadlocked ifdown against this handler.
*/

switch (event_id)
{
#ifdef ESP_WLAN_DEVS
case WIFI_EVENT_SCAN_DONE:
esp_wifi_lock(true);
esp_wifi_scan_event_parse();
esp_wifi_lock(false);
break;
#endif
case WIFI_EVENT_HOME_CHANNEL_CHANGE:
Expand All @@ -168,7 +175,9 @@ static void esp_wifi_event_handler(void *arg, esp_event_base_t event_base,
{
wlinfo("Wi-Fi sta start\n");

esp_wifi_lock(true);
ret = esp_wifi_set_ps(ps_type);
esp_wifi_lock(false);
if (ret != 0)
{
wlerr("Failed to set power save type\n");
Expand Down Expand Up @@ -214,7 +223,9 @@ static void esp_wifi_event_handler(void *arg, esp_event_base_t event_base,
{
wlinfo("INFO: Wi-Fi softap start\n");
esp_wlan_softap_connect_success_hook();
esp_wifi_lock(true);
ret = esp_wifi_set_ps(ps_type);
esp_wifi_lock(false);
if (ret != 0)
{
wlerr("Failed to set power save type\n");
Expand Down Expand Up @@ -260,7 +271,6 @@ static void esp_wifi_event_handler(void *arg, esp_event_base_t event_base,
}
}

esp_wifi_lock(false);
net_unlock();
}

Expand Down
Loading