Skip to contentSkip to conversation

Bluetooth: Move Stop Discovery to req_workqueue

PATCH In review Johan Hedberg 2 participants 2 messages Nov 11, 2015

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

PATCH v3 2/2 Bluetooth: Move Stop Discovery to req_workqueue

From: Johan Hedberg <[email protected]>

Since discovery also deals with LE scanning it makes sense to move it behind the same req_workqueue as other LE scanning changes. This also simplifies the logic since we do many of the actions in a synchronous manner.

Part of this refactoring is moving hci_req_stop_discovery() to hci_request.c. At the same time the function receives support for properly handling the STOPPING state since that's the state we'll be in when stopping through the req_workqueue.

---
 include/net/bluetooth/hci_core.h |  1 +
 net/bluetooth/hci_request.c      | 62 ++++++++++++++++++++++++++++++++++
 net/bluetooth/hci_request.h      |  3 ++
 net/bluetooth/mgmt.c             | 72 +++-------------------------------------
 4 files changed, 71 insertions(+), 67 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
index 72ea8a6d7d70..609f4a03899c 100644
@@ -1475,6 +1475,7 @@ 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);
 void mgmt_start_discovery_complete(struct hci_dev *hdev, u8 status);
+void mgmt_stop_discovery_complete(struct hci_dev *hdev, u8 status);
 void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 		       u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
 		       u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len);
net/bluetooth/hci_request.c +62 -0

74 lines not on this page · raw message

net/bluetooth/hci_request.h +3 -0
index 1927013f5e67..6b9e59f7f7a9 100644
@@ -58,6 +58,9 @@ struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen,
 void hci_req_add_le_scan_disable(struct hci_request *req);
 void hci_req_add_le_passive_scan(struct hci_request *req);
 
+/* Returns true if HCI commands were queued */
+bool hci_req_stop_discovery(struct hci_request *req);
+
 void hci_update_page_scan(struct hci_dev *hdev);
 void __hci_update_page_scan(struct hci_request *req);
 
net/bluetooth/mgmt.c +5 -67

108 lines not on this page · raw message

Signature · 1 line
2.5.0
maintainer
#1 lore raw

Hi Johan,

Quoted 10 lines

Since discovery also deals with LE scanning it makes sense to move it behind the same req_workqueue as other LE scanning changes. This also simplifies the logic since we do many of the actions in a synchronous manner.

Part of this refactoring is moving hci_req_stop_discovery() to hci_request.c. At the same time the function receives support for properly handling the STOPPING state since that's the state we'll be in when stopping through the req_workqueue.

Quoted 7 lines

---

include/net/bluetooth/hci_core.h |  1 +
net/bluetooth/hci_request.c      | 62 ++++++++++++++++++++++++++++++++++
net/bluetooth/hci_request.h      |  3 ++
net/bluetooth/mgmt.c             | 72 +++-------------------------------------
4 files changed, 71 insertions(+), 67 deletions(-)

both patches have been applied to bluetooth-next tree.

Regards

Marcel