| From e3fe12e9dfb612326788663148055ffe0ee7ff81 Mon Sep 17 00:00:00 2001 |
| From: Miao-chen Chou <mcchou@chromium.org> |
| Date: Mon, 7 Dec 2020 21:22:13 -0800 |
| Subject: [PATCH] CHROMIUM: Bluetooth: Keep MSFT extension info throughout a |
| hci_dev's life cycle |
| |
| This moves msft_do_close() from hci_dev_do_close() to |
| hci_unregister_dev() to avoid clearing MSFT extension info. This also |
| avoids retrieving MSFT info upon every msft_do_open() if MSFT extension |
| has been initialized. |
| |
| The following test steps were performed. |
| (1) boot the test device and verify the MSFT support debug log in syslog |
| (2) restart bluetoothd and verify msft_do_close() doesn't get invoked |
| |
| BUG=b:153383808 |
| TEST=perform the above test steps against octopus |
| |
| Signed-off-by: Miao-chen Chou <mcchou@chromium.org> |
| Signed-off-by: Yun-Hao Chung <howardchung@google.com> |
| Change-Id: I0794f63e6160ce542a6ff179671e641b90128f1e |
| Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2675372 |
| Reviewed-by: Archie Pusaka <apusaka@chromium.org> |
| --- |
| net/bluetooth/hci_core.c | 3 ++- |
| net/bluetooth/msft.c | 3 ++- |
| 2 files changed, 4 insertions(+), 2 deletions(-) |
| |
| diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
| index db28cfcdd697..9371bc7e0cfc 100644 |
| --- a/net/bluetooth/hci_core.c |
| +++ b/net/bluetooth/hci_core.c |
| @@ -1785,7 +1785,6 @@ int hci_dev_do_close(struct hci_dev *hdev) |
| hci_sock_dev_event(hdev, HCI_DEV_DOWN); |
| |
| aosp_do_close(hdev); |
| - msft_do_close(hdev); |
| |
| if (hdev->flush) |
| hdev->flush(hdev); |
| @@ -3992,6 +3991,8 @@ void hci_unregister_dev(struct hci_dev *hdev) |
| cancel_work_sync(&hdev->suspend_prepare); |
| } |
| |
| + msft_do_close(hdev); |
| + |
| hci_dev_do_close(hdev); |
| |
| if (!test_bit(HCI_INIT, &hdev->flags) && |
| diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c |
| index e28f15439ce4..efb429f2c768 100644 |
| --- a/net/bluetooth/msft.c |
| +++ b/net/bluetooth/msft.c |
| @@ -186,7 +186,8 @@ void msft_do_open(struct hci_dev *hdev) |
| { |
| struct msft_data *msft; |
| |
| - if (hdev->msft_opcode == HCI_OP_NOP) |
| + /* Skip if opcode is not supported or MSFT has been initiatlized */ |
| + if (hdev->msft_opcode == HCI_OP_NOP || hdev->msft_data) |
| return; |
| |
| bt_dev_dbg(hdev, "Initialize MSFT extension"); |
| -- |
| 2.17.1 |
| |