Bluetooth: Convert Set SC to use HCI Request
Subsystems (2)
PATCH 1/1 Bluetooth: Convert Set SC to use HCI Request
From: Johan Hedberg <[email protected]>
This patch converts the Set Secure Connection HCI handling to use a HCI request instead of using a hard-coded callback in hci_event.c. This e.g. ensures that we don't clear the flags incorrectly if something goes wrong with the power up process (not related to a mgmt Set SC command).
The code can also be simplified a bit since only one pending Set SC command is allowed, i.e. mgmt_pending_foreach usage is not needed.
--- include/net/bluetooth/hci_core.h | 1 - net/bluetooth/hci_event.c | 4 +- net/bluetooth/mgmt.c | 92 +++++++++++++++++++++------------------- 3 files changed, 50 insertions(+), 47 deletions(-)
include/net/bluetooth/hci_core.h +0 -1
@@ -1369,7 +1369,6 @@ int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,void mgmt_auth_failed (struct hci_conn *conn,u8 status);void mgmt_auth_enable_complete (struct hci_dev *hdev,u8 status);void mgmt_ssp_enable_complete (struct hci_dev *hdev,u8 enable,u8 status); -void mgmt_sc_enable_complete (struct hci_dev *hdev,u8 enable,u8 status);void mgmt_set_class_of_dev_complete (struct hci_dev *hdev,u8 *dev_class,u8 status);void mgmt_set_local_name_complete (struct hci_dev *hdev,u8 *name,u8 status);
net/bluetooth/hci_event.c +1 -3
@@ -525,9 +525,7 @@ static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb) hdev->features[1 ][0 ] &= ~LMP_HOST_SC ; } -if (test_bit (HCI_MGMT , &hdev->dev_flags)) -mgmt_sc_enable_complete (hdev, sent->support, status); -else if (!status) { +if (!test_bit (HCI_MGMT , &hdev->dev_flags) && !status) {if (sent->support)set_bit (HCI_SC_ENABLED , &hdev->dev_flags);else
net/bluetooth/mgmt.c +49 -43
120 lines not on this page · raw message
Signature · 1 line
2.1.0
Marcel Holtmann
maintainerHi Johan,
Quoted 8 lines
This patch converts the Set Secure Connection HCI handling to use a HCI request instead of using a hard-coded callback in
hci_event.c. This e.g. ensures that we don't clear the flags incorrectly if something goes wrong with the power up process (not related to a mgmt Set SC command).The code can also be simplified a bit since only one pending Set SC command is allowed, i.e.
mgmt_pending_foreachusage is not needed.
Quoted 6 lines
Signed-off-by Johan Hedberg <[email protected]>---
include/net/bluetooth/hci_core.h | 1 - net/bluetooth/hci_event.c | 4 +- net/bluetooth/mgmt.c | 92 +++++++++++++++++++++------------------- 3 files changed, 50 insertions(+), 47 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel