linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manish Mandlik <mmandlik@google.com>
To: marcel@holtmann.org
Cc: Yoni Shavit <yshavit@chromium.org>,
	Alain Michaud <alainm@chromium.org>,
	Miao-chen Chou <mcchou@chromium.org>,
	linux-bluetooth@vger.kernel.org,
	Dmitry Grinberg <dmitrygr@google.com>,
	Manish Mandlik <mmandlik@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH] Bluetooth: Do not cancel advertising when starting a scan
Date: Mon, 16 Mar 2020 22:40:27 -0700	[thread overview]
Message-ID: <20200316224023.1.I002569822232363cfbb5af1f33a293ea390c24c7@changeid> (raw)

From: Dmitry Grinberg <dmitrygr@google.com>

BlueZ cancels adv when starting a scan, but does not cancel a scan when
starting to adv. Neither is required, so this brings both to a
consistent state (of not affecting each other). Some very rare (I've
never seen one) BT 4.0 chips will fail to do both at once. Even this is
ok since the command that will fail will be the second one, and thus the
common sense logic of first-come-first-served is preserved for BLE
requests.

Signed-off-by: Dmitry Grinberg <dmitrygr@google.com>
Signed-off-by: Manish Mandlik <mmandlik@google.com>
---

 net/bluetooth/hci_request.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index bf83179ab9d19..649e1e5ed446a 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -2727,23 +2727,6 @@ static int active_scan(struct hci_request *req, unsigned long opt)
 
 	BT_DBG("%s", hdev->name);
 
-	if (hci_dev_test_flag(hdev, HCI_LE_ADV)) {
-		hci_dev_lock(hdev);
-
-		/* Don't let discovery abort an outgoing connection attempt
-		 * that's using directed advertising.
-		 */
-		if (hci_lookup_le_connect(hdev)) {
-			hci_dev_unlock(hdev);
-			return -EBUSY;
-		}
-
-		cancel_adv_timeout(hdev);
-		hci_dev_unlock(hdev);
-
-		__hci_req_disable_advertising(req);
-	}
-
 	/* If controller is scanning, it means the background scanning is
 	 * running. Thus, we should temporarily stop it in order to set the
 	 * discovery scanning parameters.
-- 
2.25.1.481.gfbce0eb801-goog


             reply	other threads:[~2020-03-17  5:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17  5:40 Manish Mandlik [this message]
2020-03-18 11:26 ` [PATCH] Bluetooth: Do not cancel advertising when starting a scan Marcel Holtmann
2020-03-18 11:31   ` Emil Lenngren
2020-03-18 11:54     ` 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=20200316224023.1.I002569822232363cfbb5af1f33a293ea390c24c7@changeid \
    --to=mmandlik@google.com \
    --cc=alainm@chromium.org \
    --cc=davem@davemloft.net \
    --cc=dmitrygr@google.com \
    --cc=johan.hedberg@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mcchou@chromium.org \
    --cc=netdev@vger.kernel.org \
    --cc=yshavit@chromium.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).