Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. -void hci_update_background_scan(struct hci_dev *hdev)
  2. +void hci_update_background_scan(struct hci_dev *hdev, struct hci_request *req)
  3. {
  4. - struct hci_request req;
  5. + struct hci_request local_req;
  6. struct hci_conn *conn;
  7. int err;
  8.  
  9. @@ -5724,7 +5724,10 @@ void hci_update_background_scan(struct hci_dev *hdev)
  10. */
  11. hci_discovery_filter_clear(hdev);
  12.  
  13. - hci_req_init(&req, hdev);
  14. + if (!req) {
  15. + req = &local_req;
  16. + hci_req_init(req, hdev);
  17. + }
  18.  
  19. if (list_empty(&hdev->pend_le_conns) &&
  20. list_empty(&hdev->pend_le_reports)) {
  21. @@ -5737,7 +5740,7 @@ void hci_update_background_scan(struct hci_dev *hdev)
  22. if (!test_bit(HCI_LE_SCAN, &hdev->dev_flags))
  23. return;
  24.  
  25. - hci_req_add_le_scan_disable(&req);
  26. + hci_req_add_le_scan_disable(req);
  27.  
  28. BT_DBG("%s stopping background scanning", hdev->name);
  29. } else {
  30. @@ -5757,14 +5760,18 @@ void hci_update_background_scan(struct hci_dev *hdev)
  31. * don't miss any advertising (due to duplicates filter).
  32. */
  33. if (test_bit(HCI_LE_SCAN, &hdev->dev_flags))
  34. - hci_req_add_le_scan_disable(&req);
  35. + hci_req_add_le_scan_disable(req);
  36.  
  37. - hci_req_add_le_passive_scan(&req);
  38. + hci_req_add_le_passive_scan(req);
  39.  
  40. BT_DBG("%s starting background scanning", hdev->name);
  41. }
  42.  
  43. - err = hci_req_run(&req, update_background_scan_complete);
  44. + /* Callers providing a req are responsible for calling req_run */
  45. + if (req != &local_req)
  46. + return;
  47. +
  48. + err = hci_req_run(req, update_background_scan_complete);
  49. if (err)
  50. BT_ERR("Failed to run HCI request: err %d", err);
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement