mirror of
https://github.com/shenmintao/aic8800d80.git
synced 2026-09-26 17:44:16 +00:00
Merge pull request #99 from lucaskawatoko/fix/rwnx-close-spurious-warn
fix: avoid spurious WARN in rwnx_close during USB teardown
This commit is contained in:
@@ -1518,6 +1518,17 @@ static int rwnx_close(struct net_device *dev)
|
||||
|
||||
RWNX_DBG(RWNX_FN_ENTRY_STR);
|
||||
|
||||
/*
|
||||
* A CONNECTING/DISCONNECTING state is only left when the firmware answers
|
||||
* the pending request. If the bus is already down the answer can never
|
||||
* arrive: rwnx_send_msg() silently drops the message and returns 0
|
||||
* (rwnx_msg_tx.c), so the wait below would always run its full timeout and
|
||||
* fire the spurious WARN_ON() during USB teardown. Skip the wait when the
|
||||
* bus is down, using the same condition the vif_started path uses below.
|
||||
*/
|
||||
if (bus_if &&
|
||||
(usbdev == NULL || (usbdev->bus_if->state != BUS_DOWN_ST &&
|
||||
usbdev->state != USB_DOWN_ST))) {
|
||||
test_counter = waiting_counter;
|
||||
while(atomic_read(&rwnx_vif->drv_conn_state) == (int)RWNX_DRV_STATUS_DISCONNECTING||
|
||||
atomic_read(&rwnx_vif->drv_conn_state) == (int)RWNX_DRV_STATUS_CONNECTING){
|
||||
@@ -1530,6 +1541,7 @@ static int rwnx_close(struct net_device *dev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(AICWF_USB_SUPPORT) || defined(AICWF_SDIO_SUPPORT)
|
||||
if (rwnx_hw->scanning){
|
||||
@@ -1587,6 +1599,10 @@ static int rwnx_close(struct net_device *dev)
|
||||
test_counter = waiting_counter;
|
||||
if(atomic_read(&rwnx_vif->drv_conn_state) == (int)RWNX_DRV_STATUS_CONNECTED){
|
||||
rwnx_set_conn_state(rwnx_vif, &rwnx_vif->drv_conn_state, RWNX_DRV_STATUS_DISCONNECTING);
|
||||
/* Same reasoning as above: with the bus down the disconnect
|
||||
* confirmation cannot arrive, so do not wait for it. */
|
||||
if (usbdev->bus_if->state != BUS_DOWN_ST &&
|
||||
usbdev->state != USB_DOWN_ST) {
|
||||
rwnx_send_sm_disconnect_req(rwnx_hw, rwnx_vif, 3);
|
||||
while (atomic_read(&rwnx_vif->drv_conn_state) == (int)RWNX_DRV_STATUS_DISCONNECTING) {
|
||||
AICWFDBG(LOGDEBUG, "%s wifi is disconnecting, waiting 100ms for state to stable\r\n", __func__);
|
||||
@@ -1597,6 +1613,7 @@ static int rwnx_close(struct net_device *dev)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_USE_P2P0
|
||||
if(!rwnx_vif->is_p2p_vif || ( rwnx_vif->is_p2p_vif && rwnx_hw->is_p2p_alive)){
|
||||
if (rwnx_vif->is_p2p_vif)
|
||||
|
||||
Reference in New Issue
Block a user