All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
@ 2020-12-17 22:53 Miao-chen Chou
  2020-12-17 22:53 ` [PATCH v2 2/4] Bluetooth: btqca: Enable MSFT extension for Qualcomm WCN399x Miao-chen Chou
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Miao-chen Chou @ 2020-12-17 22:53 UTC (permalink / raw)
  To: Bluetooth Kernel Mailing List
  Cc: Alain Michaud, Luiz Augusto von Dentz, Archie Pusaka,
	Marcel Holtmann, Miao-chen Chou, Abhishek Pandit-Subedi,
	David S. Miller, Jakub Kicinski, Johan Hedberg,
	Luiz Augusto von Dentz, linux-kernel, netdev

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

Signed-off-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Reviewed-by: Archie Pusaka <apusaka@chromium.org>
---

(no changes since v1)

 net/bluetooth/hci_core.c | 4 ++--
 net/bluetooth/msft.c     | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9d2c9a1c552fd..8471be105a2ac 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1780,8 +1780,6 @@ int hci_dev_do_close(struct hci_dev *hdev)
 
 	hci_sock_dev_event(hdev, HCI_DEV_DOWN);
 
-	msft_do_close(hdev);
-
 	if (hdev->flush)
 		hdev->flush(hdev);
 
@@ -3869,6 +3867,8 @@ void hci_unregister_dev(struct hci_dev *hdev)
 	unregister_pm_notifier(&hdev->suspend_notifier);
 	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 4b39534a14a18..d9d2269bc93ef 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -76,7 +76,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.29.2.684.gfbc64c5ab5-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-01-15  2:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 22:53 [PATCH v2 1/4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Miao-chen Chou
2020-12-17 22:53 ` [PATCH v2 2/4] Bluetooth: btqca: Enable MSFT extension for Qualcomm WCN399x Miao-chen Chou
2020-12-18 21:35   ` Marcel Holtmann
2020-12-17 22:53 ` [PATCH v2 3/4] Bluetooth: btusb: Enable MSFT extension for Intel controllers Miao-chen Chou
2020-12-18 21:34   ` Marcel Holtmann
2020-12-17 22:53 ` [PATCH v2 4/4] Bluetooth: btrtl: Enable MSFT extension for RTL8822CE controller Miao-chen Chou
2020-12-18 21:34   ` Marcel Holtmann
2020-12-17 23:20 ` [v2,1/4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle bluez.test.bot
2020-12-18 21:39 ` [PATCH v2 1/4] " Marcel Holtmann
2021-01-15  2:17   ` Miao-chen Chou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.