Skip to content

Commit 0b6d58b

Browse files
ChrisCH-LuVudentz
authored andcommitted
Bluetooth: btmtksdio: Do close if SDIO card removed without close
To prevent Bluetooth SDIO card from be physically removed suddenly, driver needs to ensure btmtksdio_close is called before btmtksdio_remove to disable interrupts and txrx workqueue. Fixes: 6ac4233 ("Bluetooth: btmtksdio: Prevent enabling interrupts after IRQ handler removal") Signed-off-by: Chris Lu <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 07e9004 commit 0b6d58b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/bluetooth/btmtksdio.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,11 +1447,15 @@ static void btmtksdio_remove(struct sdio_func *func)
14471447
if (!bdev)
14481448
return;
14491449

1450+
hdev = bdev->hdev;
1451+
1452+
/* Make sure to call btmtksdio_close before removing sdio card */
1453+
if (test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state))
1454+
btmtksdio_close(hdev);
1455+
14501456
/* Be consistent the state in btmtksdio_probe */
14511457
pm_runtime_get_noresume(bdev->dev);
14521458

1453-
hdev = bdev->hdev;
1454-
14551459
sdio_set_drvdata(func, NULL);
14561460
hci_unregister_dev(hdev);
14571461
hci_free_dev(hdev);

0 commit comments

Comments
 (0)