diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2015-01-06 21:36:56 -0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-01-08 06:36:50 +0100 |
commit | a9cc32d96c62b230c664a362b5f3206d3bcf35b8 (patch) | |
tree | c56bfdb6db4bd6a953618c7c424cb0acf155c4c7 /drivers/bluetooth/btmrvl_main.c | |
parent | 0333d6dd3bc17468f42d0c455113fd9d50f7746e (diff) | |
download | talos-obmc-linux-a9cc32d96c62b230c664a362b5f3206d3bcf35b8.tar.gz talos-obmc-linux-a9cc32d96c62b230c664a362b5f3206d3bcf35b8.zip |
Bluetooth: btmrvl: fix card reset and suspend race issue
Sometimes suspend thread queues a command and wait for it's
response, meanwhile WLAN driver power cycles the card which
leads to crash. This patch makes sure that suspend thread is
woken up in remove path.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/btmrvl_main.c')
-rw-r--r-- | drivers/bluetooth/btmrvl_main.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index 2578b29f1cd1..413597789c61 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c @@ -207,10 +207,14 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, wake_up_interruptible(&priv->main_thread.wait_q); if (!wait_event_interruptible_timeout(priv->adapter->cmd_wait_q, - priv->adapter->cmd_complete, + priv->adapter->cmd_complete || + priv->surprise_removed, WAIT_UNTIL_CMD_RESP)) return -ETIMEDOUT; + if (priv->surprise_removed) + return -EFAULT; + return 0; } @@ -292,9 +296,10 @@ int btmrvl_enable_hs(struct btmrvl_private *priv) } ret = wait_event_interruptible_timeout(adapter->event_hs_wait_q, - adapter->hs_state, + adapter->hs_state || + priv->surprise_removed, WAIT_UNTIL_HS_STATE_CHANGED); - if (ret < 0) { + if (ret < 0 || priv->surprise_removed) { BT_ERR("event_hs_wait_q terminated (%d): %d,%d,%d", ret, adapter->hs_state, adapter->ps_state, adapter->wakeup_tries); |