[PATCH v1 2/2] Bluetooth: btmtksdio: Do close if SDIO card removed without close
Luiz Augusto von Dentz
luiz.dentz at gmail.com
Mon Apr 21 12:19:51 PDT 2025
Hi Chris,
On Mon, Apr 21, 2025 at 3:29 AM Chris Lu <chris.lu at mediatek.com> wrote:
>
> To prevent Bluetooth SDIO card from being physically removed suddenly,
> driver needs to ensure btmtksdio_close is called before btmtksdio_remove
> to disable interrupts and txrx workqueue.
>
> Signed-off-by: Chris Lu <chris.lu at mediatek.com>
Ditto, please add Fixes tag.
> ---
> drivers/bluetooth/btmtksdio.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
> index 3c66e3ee9834..c16a3518b8ff 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);
> --
> 2.45.2
>
--
Luiz Augusto von Dentz
More information about the Linux-mediatek
mailing list