aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorChris Lu <chris.lu@mediatek.com>2025-04-22 09:21:56 +0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2025-04-25 15:03:19 -0400
commit0b6d58bc6ea85e57de25c828444928e4a0aa79cb (patch)
treebeda240d31ac4753f21af60cc809610562d4dfd1 /drivers/bluetooth
parentBluetooth: btmtksdio: Check function enabled before doing close (diff)
downloadlinux-rng-0b6d58bc6ea85e57de25c828444928e4a0aa79cb.tar.xz
linux-rng-0b6d58bc6ea85e57de25c828444928e4a0aa79cb.zip
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: 6ac4233afb9a ("Bluetooth: btmtksdio: Prevent enabling interrupts after IRQ handler removal") Signed-off-by: Chris Lu <chris.lu@mediatek.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btmtksdio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index e5a119ca7243..1d26207b2ba7 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -1447,11 +1447,15 @@ static void btmtksdio_remove(struct sdio_func *func)
if (!bdev)
return;
+ hdev = bdev->hdev;
+
+ /* Make sure to call btmtksdio_close before removing sdio card */
+ if (test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state))
+ btmtksdio_close(hdev);
+
/* Be consistent the state in btmtksdio_probe */
pm_runtime_get_noresume(bdev->dev);
- hdev = bdev->hdev;
-
sdio_set_drvdata(func, NULL);
hci_unregister_dev(hdev);
hci_free_dev(hdev);