From: Andre Guedes <andre.guedes@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v3 05/14] Bluetooth: Move discovery macros to hci_core.h
Date: Tue, 30 Apr 2013 15:29:31 -0300 [thread overview]
Message-ID: <1367346580-6647-6-git-send-email-andre.guedes@openbossa.org> (raw)
In-Reply-To: <1367346580-6647-1-git-send-email-andre.guedes@openbossa.org>
Some of discovery macros will be used in hci_core so we need to
define them in common place such as hci_core.h. Thus, this patch
moves discovery macros to hci_core.h and also adds the DISCOV_
prefix to them.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
---
include/net/bluetooth/hci_core.h | 10 ++++++++++
net/bluetooth/mgmt.c | 24 ++++++------------------
2 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index aa7eed7..ab280f5 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1115,6 +1115,16 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
BIT(BDADDR_LE_PUBLIC) | \
BIT(BDADDR_LE_RANDOM))
+/* These LE scan and inquiry parameters were chosen according to LE General
+ * Discovery Procedure specification.
+ */
+#define DISCOV_LE_SCAN_WIN 0x12
+#define DISCOV_LE_SCAN_INT 0x12
+#define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240)
+#define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120)
+#define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04
+#define DISCOV_BREDR_INQUIRY_LEN 0x08
+
int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
int mgmt_index_added(struct hci_dev *hdev);
int mgmt_index_removed(struct hci_dev *hdev);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 0572cb1..8ec0944 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -102,18 +102,6 @@ static const u16 mgmt_events[] = {
MGMT_EV_PASSKEY_NOTIFY,
};
-/*
- * These LE scan and inquiry parameters were chosen according to LE General
- * Discovery Procedure specification.
- */
-#define LE_SCAN_WIN 0x12
-#define LE_SCAN_INT 0x12
-#define LE_SCAN_TIMEOUT_LE_ONLY msecs_to_jiffies(10240)
-#define LE_SCAN_TIMEOUT_BREDR_LE msecs_to_jiffies(5120)
-
-#define INQUIRY_LEN_BREDR 0x08 /* TGAP(100) */
-#define INQUIRY_LEN_BREDR_LE 0x04 /* TGAP(100)/2 */
-
#define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000)
#define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \
@@ -2641,7 +2629,7 @@ int mgmt_interleaved_discovery(struct hci_dev *hdev)
hci_dev_lock(hdev);
- err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR_LE);
+ err = hci_do_inquiry(hdev, DISCOV_INTERLEAVED_INQUIRY_LEN);
if (err < 0)
hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
@@ -2689,12 +2677,12 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status)
switch (hdev->discovery.type) {
case DISCOV_TYPE_LE:
queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable,
- LE_SCAN_TIMEOUT_LE_ONLY);
+ DISCOV_LE_TIMEOUT);
break;
case DISCOV_TYPE_INTERLEAVED:
queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable,
- LE_SCAN_TIMEOUT_BREDR_LE);
+ DISCOV_INTERLEAVED_TIMEOUT);
break;
case DISCOV_TYPE_BREDR:
@@ -2770,7 +2758,7 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev,
memset(&inq_cp, 0, sizeof(inq_cp));
memcpy(&inq_cp.lap, lap, sizeof(inq_cp.lap));
- inq_cp.length = INQUIRY_LEN_BREDR;
+ inq_cp.length = DISCOV_BREDR_INQUIRY_LEN;
hci_req_add(&req, HCI_OP_INQUIRY, sizeof(inq_cp), &inq_cp);
break;
@@ -2807,8 +2795,8 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev,
memset(¶m_cp, 0, sizeof(param_cp));
param_cp.type = LE_SCAN_ACTIVE;
- param_cp.interval = cpu_to_le16(LE_SCAN_INT);
- param_cp.window = cpu_to_le16(LE_SCAN_WIN);
+ param_cp.interval = cpu_to_le16(DISCOV_LE_SCAN_INT);
+ param_cp.window = cpu_to_le16(DISCOV_LE_SCAN_WIN);
hci_req_add(&req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(param_cp),
¶m_cp);
--
1.8.2.1
next prev parent reply other threads:[~2013-04-30 18:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-30 18:29 [PATCH v3 00/14] Update Discovery to use HCI request framework Andre Guedes
2013-04-30 18:29 ` [PATCH v3 01/14] Bluetooth: Make inquiry_cache_flush non-static Andre Guedes
2013-04-30 18:29 ` [PATCH v3 02/14] Bluetooth: Update start_discovery to use HCI request Andre Guedes
2013-04-30 18:29 ` [PATCH v3 03/14] Bluetooth: Remove start discovery handling from hci_event.c Andre Guedes
2013-04-30 18:29 ` [PATCH v3 04/14] Bluetooth: Make mgmt_start_discovery_failed static Andre Guedes
2013-04-30 18:29 ` Andre Guedes [this message]
2013-04-30 18:29 ` [PATCH v3 06/14] Bluetooth: Use HCI request in interleaved discovery Andre Guedes
2013-04-30 18:29 ` [PATCH v3 07/14] Bluetooth: Update stop_discovery to use HCI request Andre Guedes
2013-04-30 18:29 ` [PATCH v3 08/14] Bluetooth: Remove stop discovery handling from hci_event.c Andre Guedes
2013-04-30 18:29 ` [PATCH v3 09/14] Bluetooth: Make mgmt_stop_discovery_failed static Andre Guedes
2013-04-30 18:29 ` [PATCH v3 10/14] Bluetooth: Refactor hci_cc_le_set_scan_enable Andre Guedes
2013-04-30 18:29 ` [PATCH v3 11/14] Bluetooth: Remove LE scan helpers Andre Guedes
2013-04-30 18:29 ` [PATCH v3 12/14] Bluetooth: Remove inquiry helpers Andre Guedes
2013-04-30 18:29 ` [PATCH v3 13/14] Bluetooth: Remove empty event handler Andre Guedes
2013-04-30 18:29 ` [PATCH v3 14/14] Bluetooth: Mgmt Device Found Event Andre Guedes
2013-05-03 22:25 ` Gustavo Padovan
2013-05-02 1:59 ` [PATCH v3 00/14] Update Discovery to use HCI request framework Marcel Holtmann
2013-05-02 13:16 ` Andre Guedes
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=1367346580-6647-6-git-send-email-andre.guedes@openbossa.org \
--to=andre.guedes@openbossa.org \
--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