summaryrefslogtreecommitdiff
path: root/drivers/bluetooth/btmrvl_main.c
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2015-01-01 11:13:41 +0300
committerMarcel Holtmann <marcel@holtmann.org>2015-01-06 18:19:35 +0300
commit7b4b8740c6fc153fbb24b3c1ac391cf8908ad113 (patch)
tree8eef99bf9f66208596533e6849851b992e98e159 /drivers/bluetooth/btmrvl_main.c
parent9b89fdfee47de2d5d904a36cb85304e1ba80934d (diff)
downloadlinux-7b4b8740c6fc153fbb24b3c1ac391cf8908ad113.tar.xz
Bluetooth: btmrvl: add surprise_removed flag
This flag will be set in unload path to make sure that we skip sending further commands, ignore interrupts and stop main thread when unload starts. 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.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index c435b58db597..c4a542cc3214 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -178,6 +178,11 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode,
struct sk_buff *skb;
struct hci_command_hdr *hdr;
+ if (priv->surprise_removed) {
+ BT_ERR("Card is removed");
+ return -EFAULT;
+ }
+
skb = bt_skb_alloc(HCI_COMMAND_HDR_SIZE + len, GFP_ATOMIC);
if (skb == NULL) {
BT_ERR("No free skb");
@@ -600,7 +605,7 @@ static int btmrvl_service_main_thread(void *data)
add_wait_queue(&thread->wait_q, &wait);
set_current_state(TASK_INTERRUPTIBLE);
- if (kthread_should_stop()) {
+ if (kthread_should_stop() || priv->surprise_removed) {
BT_DBG("main_thread: break from main thread");
break;
}
@@ -619,7 +624,7 @@ static int btmrvl_service_main_thread(void *data)
BT_DBG("main_thread woke up");
- if (kthread_should_stop()) {
+ if (kthread_should_stop() || priv->surprise_removed) {
BT_DBG("main_thread: break from main thread");
break;
}