Linux bluetooth development
 help / color / mirror / Atom feed
From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 8/9] Bluetooth: Move HCI_LIMITED_DISCOVERABLE changes to a general place
Date: Sat, 19 Oct 2013 23:38:22 +0300	[thread overview]
Message-ID: <1382215103-6968-9-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1382215103-6968-1-git-send-email-johan.hedberg@gmail.com>

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

We'll soon be introducing also LE support for the Set Discoverable
management command, so move the HCI_LIMITED_DISCOVERABLE flag clearing
and setting out from the if-branch that is only used for a BR/EDR
specific HCI command.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/mgmt.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 67b95a8..796db58 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1220,6 +1220,12 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
 	cancel_delayed_work(&hdev->discov_off);
 	hdev->discov_timeout = timeout;
 
+	/* Limited discoverable mode */
+	if (cp->val == 0x02)
+		set_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
+	else
+		clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
+
 	hci_req_init(&req, hdev);
 
 	scan = SCAN_PAGE;
@@ -1229,8 +1235,6 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
 
 		if (cp->val == 0x02) {
 			/* Limited discoverable mode */
-			set_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
-
 			hci_cp.num_iac = 2;
 			hci_cp.iac_lap[0] = 0x00;	/* LIAC */
 			hci_cp.iac_lap[1] = 0x8b;
@@ -1240,8 +1244,6 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
 			hci_cp.iac_lap[5] = 0x9e;
 		} else {
 			/* General discoverable mode */
-			clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
-
 			hci_cp.num_iac = 1;
 			hci_cp.iac_lap[0] = 0x33;	/* GIAC */
 			hci_cp.iac_lap[1] = 0x8b;
-- 
1.8.3.1


  parent reply	other threads:[~2013-10-19 20:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-19 20:38 [PATCH 0/9] Bluetooth: Add LE support for mgmt_set_discoverable johan.hedberg
2013-10-19 20:38 ` [PATCH 1/9] Bluetooth: Check for flag instead of features in update_scan_rsp_data() johan.hedberg
2013-10-19 20:38 ` [PATCH 2/9] Bluetooth: Check for flag instead of features in update_adv_data() johan.hedberg
2013-10-19 20:38 ` [PATCH 3/9] Bluetooth: Add missing check for BREDR_ENABLED flag in update_class() johan.hedberg
2013-10-19 20:38 ` [PATCH 4/9] Bluetooth: Refactor set_connectable settings update to separate function johan.hedberg
2013-10-19 20:38 ` [PATCH 5/9] Bluetooth: Fix updating settings when there are no HCI commands to send johan.hedberg
2013-10-19 20:38 ` [PATCH 6/9] Bluetooth: Move mgmt_pending_find to avoid forward declarations johan.hedberg
2013-10-19 20:38 ` [PATCH 7/9] Bluetooth: Fix sending write_scan_enable when BR/EDR is disabled johan.hedberg
2013-10-19 20:38 ` johan.hedberg [this message]
2013-10-19 20:38 ` [PATCH 9/9] Bluetooth: Update Set Discoverable to support LE johan.hedberg
2013-10-19 22:11   ` Marcel Holtmann
2013-10-20  8:55   ` [PATCH v2] " johan.hedberg
2013-10-20 16:00     ` [PATCH v3] " johan.hedberg
2013-10-20 16:07       ` 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=1382215103-6968-9-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