Skip to contentSkip to conversation

Bluetooth: Convert Set SC to use HCI Request

PATCH In review Johan Hedberg 2 participants 2 messages Jan 23, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index 7777124bff55..0f5e59f1e3cb 100644
@@ -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
index a58845e98921..e2b81adc232f 100644
@@ -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
maintainer
#1 lore raw

Hi 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_foreach usage is not needed.

Quoted 6 lines

---

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