linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 01/12] Bluetooth: Add stubs for synchronous HCI request functionality
Date: Wed, 11 Nov 2015 08:11:16 +0200	[thread overview]
Message-ID: <1447222287-4288-2-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1447222287-4288-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

Prepare hci_request.c to have code for doing synchronous HCI requests,
such as LE scanning or advertising changes. The necessary work
callbacks will be set up in hci_request_setup() and cleaned up in
hci_request_cancel_all(). The former is used when an HCI device get
registered, and the latter each time it is powered off (or
unregistered).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/hci_core.c    | 4 ++++
 net/bluetooth/hci_request.c | 8 ++++++++
 net/bluetooth/hci_request.h | 3 +++
 3 files changed, 15 insertions(+)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index ea7cad5a161c..d6fc485fe8a1 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1604,6 +1604,8 @@ int hci_dev_do_close(struct hci_dev *hdev)
 
 	hci_req_sync_unlock(hdev);
 
+	hci_request_cancel_all(hdev);
+
 	hci_dev_put(hdev);
 	return 0;
 }
@@ -3156,6 +3158,8 @@ struct hci_dev *hci_alloc_dev(void)
 
 	INIT_DELAYED_WORK(&hdev->cmd_timer, hci_cmd_timeout);
 
+	hci_request_setup(hdev);
+
 	hci_init_sysfs(hdev);
 	discovery_init(hdev);
 
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index ae19bce89616..d48206277fe4 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -845,3 +845,11 @@ int hci_abort_conn(struct hci_conn *conn, u8 reason)
 
 	return 0;
 }
+
+void hci_request_setup(struct hci_dev *hdev)
+{
+}
+
+void hci_request_cancel_all(struct hci_dev *hdev)
+{
+}
diff --git a/net/bluetooth/hci_request.h b/net/bluetooth/hci_request.h
index 5b3240cf9eb7..9759b7175f8e 100644
--- a/net/bluetooth/hci_request.h
+++ b/net/bluetooth/hci_request.h
@@ -70,3 +70,6 @@ void __hci_update_background_scan(struct hci_request *req);
 int hci_abort_conn(struct hci_conn *conn, u8 reason);
 void __hci_abort_conn(struct hci_request *req, struct hci_conn *conn,
 		      u8 reason);
+
+void hci_request_setup(struct hci_dev *hdev);
+void hci_request_cancel_all(struct hci_dev *hdev);
-- 
2.5.0


  reply	other threads:[~2015-11-11  6:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11  6:11 [PATCH v2 00/12] Bluetooth: Move LE scan changes behind req_workqueue Johan Hedberg
2015-11-11  6:11 ` Johan Hedberg [this message]
2015-11-11  6:11 ` [PATCH v2 02/12] Bluetooth: Run all background scan updates through req_workqueue Johan Hedberg
2015-11-11  6:11 ` [PATCH v2 03/12] Bluetooth: Don't wait for HCI in Add/Remove Device Johan Hedberg
2015-11-11  6:11 ` [PATCH v2 04/12] Bluetooth: Add HCI status return parameter to hci_req_sync() Johan Hedberg
2015-11-11  6:11 ` [PATCH v2 05/12] Bluetooth: Use req_workqueue for explicit connect requests Johan Hedberg
2015-11-11  6:11 ` [PATCH v2 06/12] Bluetooth: Use req_workqueue for background scanning when powering on Johan Hedberg
2015-11-11  6:11 ` [PATCH v2 07/12] Bluetooth: Make __hci_update_background_scan private to hci_request.c Johan Hedberg
2015-11-11  6:11 ` [PATCH v2 08/12] Bluetooth: Move LE scan disable/restart behind req_workqueue Johan Hedberg
2015-11-11  6:11 ` [PATCH v2 09/12] Bluetooth: Add discovery type validity helper Johan Hedberg
2015-11-11  6:11 ` [PATCH v2 10/12] Bluetooth: Add error return value to hci_req_sync callback Johan Hedberg
2015-11-11  6:14 ` [PATCH v2 12/12] Bluetooth: Move Stop Discovery to req_workqueue Johan Hedberg
2015-11-11  6:26 ` [PATCH v2 00/12] Bluetooth: Move LE scan changes behind req_workqueue Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447222287-4288-2-git-send-email-johan.hedberg@gmail.com \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).