From patchwork Tue Mar 17 05:40:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Mandlik X-Patchwork-Id: 11441823 X-Patchwork-Delegate: marcel@holtmann.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01B52913 for ; Tue, 17 Mar 2020 05:40:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB520206EC for ; Tue, 17 Mar 2020 05:40:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PYz7uO05" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726132AbgCQFkh (ORCPT ); Tue, 17 Mar 2020 01:40:37 -0400 Received: from mail-ua1-f73.google.com ([209.85.222.73]:36827 "EHLO mail-ua1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbgCQFkf (ORCPT ); Tue, 17 Mar 2020 01:40:35 -0400 Received: by mail-ua1-f73.google.com with SMTP id m10so2175688uap.3 for ; Mon, 16 Mar 2020 22:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=el82hvu8NsarLBH+1bSM5mOhPUGbPGRaUwoQglxhFZs=; b=PYz7uO05mG25NfUmMbpjZKCOZbxuF3u1CeNkjJDeW4SMOhqxfZ8/yJnrMmXdi5VeV9 jLeEmHj7qIs4osoWmBuCse20pEigoQMUyodNp4LVCkIFfxAmuJGBmppBctcZwXwFJswS OvZOFL6C0u/qSaIFvukwFUyXBft83T5SZ5hENFMj2ZDSiVK95DInCXLMfOWVnKSZx5El 8gf+eV+iBgYPGi0qZWqUk+HDBB8rxlPmuysjBNfDUEerKhf6EvCQqedBOafPX0dlv4lP IcCYZvNxs09Abb1wNrlU1kT9ge6uVBZGxxeopIZQYjEiRQECmydKvBsibIEdfkGryNnY mPrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=el82hvu8NsarLBH+1bSM5mOhPUGbPGRaUwoQglxhFZs=; b=kz9XCF0kOSdNWARrAfeN227HgoCkjjOPY96/5ckv1PlheJGUasQpXUinVgF6Ut348g yaXMbMEUBcXjzKvK89cWbfMlJw3DvjRP3cF3Wil77fDWfpSwCShSoAKTJRANPoXdnTuS OvaX1l2SXejpnky8KFi4KBpiU/PAaZeRnrDemSeUQfKDAc54RBAbYT6M4wC0wx/10VFF YvPL8Pasy5BsP6ic6MQE6tTyUjzVfaTj36JpYVhkRoqyVAAxOdCtBMRIKz3jQQjoJqSi oPuit7bz3mjoOLI1F4avkmmt9HIhWPQGQPv5u+Jlt+UTgLNw6vXQLvSn5C2T0xD+uy66 lOuA== X-Gm-Message-State: ANhLgQ0cEUw1gbXVYp2+OdwNDdeqPxVI/iWAbjPDOnT1ja/6BP962tad /wwvPeBetP+0oVPCfZ7qygAnBJGgxddiQQ== X-Google-Smtp-Source: ADFU+vvobSt7t9RrwR/m04uzP8LCbT1bE28OruemFxbEsN4zMun2S8b74DOmhSvpXfrTSMb4P36QDEyPRn8AGw== X-Received: by 2002:ab0:614c:: with SMTP id w12mr2373505uan.141.1584423632602; Mon, 16 Mar 2020 22:40:32 -0700 (PDT) Date: Mon, 16 Mar 2020 22:40:27 -0700 Message-Id: <20200316224023.1.I002569822232363cfbb5af1f33a293ea390c24c7@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog Subject: [PATCH] Bluetooth: Do not cancel advertising when starting a scan From: Manish Mandlik To: marcel@holtmann.org Cc: Yoni Shavit , Alain Michaud , Miao-chen Chou , linux-bluetooth@vger.kernel.org, Dmitry Grinberg , Manish Mandlik , "David S. Miller" , Johan Hedberg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Kicinski Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Dmitry Grinberg 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 Signed-off-by: Manish Mandlik --- 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.