Thread (5 messages) flat view 5 messages, 3 authors, 2021-10-14

Re: [PATCH v3] Bluetooth: vhci: Add support for setting msft_opcode and aosp_capable

From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2021-10-14 17:23:49
Subsystem: bluetooth drivers, bluetooth subsystem, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

Hi Marcel,

On Thu, Oct 14, 2021 at 5:39 AM Marcel Holtmann [off-list ref] wrote:
Hi Luiz,
quoted
This adds a debugfs entries to set msft_opcode and aosp_capable enabling
vhci to emulate controllers with MSFT/AOSP extension support.

Signed-off-by: Luiz Augusto von Dentz <redacted>
---
v2: Fix typos: s/extention/extension/g
v3: Remove checks for HCI_SETUP, merge changes to introduce MSFT/AOSP support
at the same time.

drivers/bluetooth/hci_vhci.c | 92 ++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
patch has been applied to bluetooth-next tree (with slight modifications).
++<<<<<<< HEAD
 +      hci_set_msft_opcode(hdev, vhci->msft_opcode);
 +      hci_set_aosp_capable(hdev);
++=======
+       if (vhci->msft_opcode)
+               hci_set_msft_opcode(hdev, vhci->msft_opcode);
+
+       if (vhci->aosp_capable)
+               hci_set_aosp_capable(hdev);
++>>>>>>> 9bbbb6a7ad09 (Bluetooth: vhci: Add support for setting
msft_opcode and aosp_capable)

I suspect the above changes won't work if we don't init the fields in
the vhci_data, msft_opcode would be set to 0x0000 so it won't be
enabled anyway but aosp_capable would be enabled which would be out of
sync with vhci->aosp_capable, so perhaps we want to change
hci_set_aosp_capable to take a parameter:
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 74c0eb28c422..9e67517b6cef 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -264,7 +264,7 @@ static int vhci_setup(struct hci_dev *hdev)
        struct vhci_data *vhci = hci_get_drvdata(hdev);

        hci_set_msft_opcode(hdev, vhci->msft_opcode);
-       hci_set_aosp_capable(hdev);
+       hci_set_aosp_capable(hdev, vhci->aosp_capable);

        return 0;
 }
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index dd8840e70e25..d007b487d4c1 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1279,10 +1279,10 @@ static inline void hci_set_msft_opcode(struct
hci_dev *hdev, __u16 opcode)
 #endif
 }

-static inline void hci_set_aosp_capable(struct hci_dev *hdev)
+static inline void hci_set_aosp_capable(struct hci_dev *hdev, bool enable)
 {
 #if IS_ENABLED(CONFIG_BT_AOSPEXT)
-       hdev->aosp_capable = true;
+       hdev->aosp_capable = enable;
 #endif
 }

Regards

Marcel

-- 
Luiz Augusto von Dentz
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help