Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3395792ybh; Mon, 16 Mar 2020 22:41:59 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtown4GVaUC9Udf7xNYUaQLTmvuGVdEUyOl85eYs+fCLXVdFDpTJYD2xX8W5JKwvW30aRQf X-Received: by 2002:a05:6830:13c7:: with SMTP id e7mr2347694otq.5.1584423719118; Mon, 16 Mar 2020 22:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584423719; cv=none; d=google.com; s=arc-20160816; b=TqjEPEn6cmsWFIVKwmzx65miDZlMXd4OfGpa3sX37tDJvHDXECJWMkXc27Z9lCmnwU ROE7tswfm/mE8HfRbNQHC7ghDo48oa8fRvdxuusthOsiVHNULnOP59ykd7XX9cv8I5yb +wvStGUz47p0oZ3OzW5NUECV1W2DrsrUFcTs79zvoXk3PyVxq2IUDwFNmQQrSKeBf5vs p6FJFBv4Io5/wrb7Cf1Ldw+90eeq5uGas9k0k+KKe3uNG9lHomjAf82ku9M9B5e2q8aN /bRKWqXAMR8WneU+xvP3K6uZL6++6BQ3AcRv8rGbBPrWqzFN11nxWb8lHRB//Zc/di1F o0Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=el82hvu8NsarLBH+1bSM5mOhPUGbPGRaUwoQglxhFZs=; b=Zrgr1h2AF52lHFsiGX/aQTEoSGvKtXTxduBkYs4ck/TaPoFyDpgx8Mc7dZCrVJMq+x qjCcwWvuUSyak/BbkN3Fc7cBD0+8DxckvsYdEi9AjyCL+JE/PH4kMdRoBITHg7O688X0 bcnRgmlsfNDFZrU7pz1FLTIfNt7ceeinwLadumk7gt38R5ovN7UEijHEN6ZSp5uncqkH Md77Nuwfe3XdwbKKy582COgQMDWGgVDPE4w1/2H4hCNcphvDJsqEznFJ9Eha6SmR4VDg 0kcWaoUZ2pZl9d1OXjpLMshxuBBlxhjNFmGMG3vkQSrsyvdy5PFe70/v+zux+/fMfUsM zT6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PYz7uO05; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z65si1213078otb.197.2020.03.16.22.41.44; Mon, 16 Mar 2020 22:41:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PYz7uO05; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726039AbgCQFke (ORCPT + 99 others); Tue, 17 Mar 2020 01:40:34 -0400 Received: from mail-vk1-f202.google.com ([209.85.221.202]:41856 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbgCQFkd (ORCPT ); Tue, 17 Mar 2020 01:40:33 -0400 Received: by mail-vk1-f202.google.com with SMTP id i123so8825998vkg.8 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=aOa0q+ASuKslNdLuRzK8g7F6tW5qvmHF/NSHV6xOc1vIeDOm+8pYYHOcgEneapl1rY MScQMeZtObqPMOzGvISb8GaCBLdRII7XPsEH5vLyB4A9N2WVzAb+hyY3A2hp71z5rCvo 1+He2WZf5zi9aZqT05N9oO/bVqvncwXi3IqF96gF7g2v/BV+QnpSsKf1vJhzaF2Srd5R WL5Ql1mUaCokw9KlqFXxaHNSJEfSgKE/jMlhKg2GI32TQ6e+J0K2PAYQc8oCzXSCJUjm kIjDE5aga1csW6T8g2yTk5fpJmfz0uzf4rSYDi0OdaKQ4zFEXxlXXb8PnyczLsGXkMKL bJcQ== X-Gm-Message-State: ANhLgQ27Rxwsg1yI+klcbg94cGGn0CPNMqgsSIisDaL+S8ZSbSHEeGCe ApKhEe5cSXhqk3e3ivtgOhG9FVIFx0yoWg== 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. -- 2.25.1.481.gfbce0eb801-goog