Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1255073ybg; Tue, 2 Jun 2020 05:29:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGp9bqCvv2bXS8cWNFI3lLwxXJl9Uf1eRZLo/SvTo6vROEUTYyVfQriE3tYVeU/BLpALeW X-Received: by 2002:a17:906:1d56:: with SMTP id o22mr17467571ejh.406.1591100948231; Tue, 02 Jun 2020 05:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591100948; cv=none; d=google.com; s=arc-20160816; b=Oz1BwgY9Ksb5et+2rrfAkKCN4rX0KcMX3qto7bVK55FMCSMs0qr1l+xT9NA/DGHs/2 Osm8FFo7lnZZZAiEHCjR+CNO6WqnwgfWOfjBww+o2KdnBGoza4ukmnEhzujE9G3r0V7Z X1qjwPrt0arYbLGtYjs3v4tlf0RmIi1YHe5yZ3dpYfKmFejMLGsJi/wcDeiPwpDpjZZV xkxP8N7uBhOnygqmoMZpknvc2AxsX/z9+fEjkZSiSiGcaKuhtLuMLSendmegsZdOoZsV dTaqrnwEzGqMCSeI4H9tNmMxr5Nko26QEXxF28Lmq8PQCtJTCkBk77Y/9L7jHonnsE18 tKeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=SzkhBbLbmHxP92irZBt7jTabNaEj2bzN89Fv4cbtbow=; b=s4Tl00p5SwhSU/vWMRHcECHwkKf679tSz5pQDetknNLJdEaE9l7FWywsR6NIc5khZv 7BsQD4kBEjC28jSgpwCU+LZUofxIMQTc7ZKBpzVnfEJEHkjUyaVoMcgi3jsQIYTZ2L8C DZBgp5nTmyPrzP/ID6nMzR3dMIBOAXn+441lIzm/owwp3lPOajLylDCSslAFUBBoJbXT 0P82K9QyPjqvUtMfVXpYEJuU2YqJ/tYzKPLHM91khHVZ8Pegd8Z1sctRJ/3VDu9n9fqN dOBYLMJ2Zk5CBOT27C8amRNrqUQvHmLMtVJ2P2u1yHbUQSst+EqPU4M0SCmVaau1+98x lphw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RlVJzfDP; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-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. [23.128.96.18]) by mx.google.com with ESMTP id c3si1387641eja.251.2020.06.02.05.28.24; Tue, 02 Jun 2020 05:29:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RlVJzfDP; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-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 S1727839AbgFBM1N (ORCPT + 99 others); Tue, 2 Jun 2020 08:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbgFBM1M (ORCPT ); Tue, 2 Jun 2020 08:27:12 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FDC6C08C5C1 for ; Tue, 2 Jun 2020 05:27:12 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id o9so12328512ljj.6 for ; Tue, 02 Jun 2020 05:27:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SzkhBbLbmHxP92irZBt7jTabNaEj2bzN89Fv4cbtbow=; b=RlVJzfDPTeQf0cs8V529R1SL0IM9WLu1oq53oOBFnQc8CK7laDj1EXvNHcyNU7V3zL +hXDt9b/b0xTrPHdqxXc5mLcM7EJ5dVO2I6Ug3oXT2mUdocCSC7VVaPksud5NiZ/Ilau NcI7/WOUlhrUOn8q+a1lZth0gnGnO6+uO9LCCqPMKUVPhG1j0feT4IjzQFd61Mz7JMqd nF71TdjlYJsmbzlQ4edArYM9MhueZrxOvwjZSJixgZAfpUBPhI8cbipg3duiOWySK80w FkASaPRR625pL/WUC6R1Kj6Aos86ohAjKZvRtqfOwppDQLRNljFWYBEx0ESYjA4CC/44 Tuog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SzkhBbLbmHxP92irZBt7jTabNaEj2bzN89Fv4cbtbow=; b=BYh5TWaM8WSVfm2KZ6sSXdcz9l0MRmHrdgjEiqsNkTO4Pi5nXbAIu33vQ88BHR+dX3 bFUHZrc3vVyrZLrn4U5TuVu6x3Qpo+XaKGpvOinYbcre1S9rRUeWx8+XngKwydtdJLLF Ub5cm9nOwHoVEA/tQ1DeScP3O0oHb/wbNJPVLQLvG38JfUn8MRNO/OOQnGSliVlOUh9G s8nvmApANQbuQtECeAve0qHuOlH9D1Z6svXEhR37fwAd/EkwmqBVlhB2b/Qm9uHZBCEm NxlXycsufsdJ/8r6oBB8oPsfrkTamklK3w5nbYeO5Q5KGH2MAmJFkSj2o4NfbJN/MXtu zipQ== X-Gm-Message-State: AOAM533HxS5KY1/a6Z1UYwkGkMpemIShU0ktR88Iv9jI6aKSdq6i+pQp zUHG27iAFwMFN6fh6jRhF9VL7oNFGQcdxxVSwix67w== X-Received: by 2002:a2e:9ad6:: with SMTP id p22mr7949105ljj.3.1591100830499; Tue, 02 Jun 2020 05:27:10 -0700 (PDT) MIME-Version: 1.0 References: <20200601184223.1.I281c81384150e8fefbebf32fa79cb091d0311208@changeid> In-Reply-To: From: Alain Michaud Date: Tue, 2 Jun 2020 08:26:59 -0400 Message-ID: Subject: Re: [PATCH] Bluetooth: Check scan state before disabling during suspend To: Abhishek Pandit-Subedi Cc: Manish Mandlik , Marcel Holtmann , Luiz Augusto von Dentz , Bluez mailing list , ChromeOS Bluetooth Upstreaming , "David S. Miller" , Johan Hedberg , netdev , LKML , Jakub Kicinski Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Mon, Jun 1, 2020 at 9:49 PM Abhishek Pandit-Subedi wrote: > > Hey linux-bluetooth, > > We found this bug when reverting some Chromium maintained patches in > our repository that was conditionally dropping LE scan enable commands > if it wasn't toggling between true/false. On some Intel controllers, > disabling LE scan when it's already disabled resulted in a "Command > Disallowed" and this was causing suspend to fail. > > On Mon, Jun 1, 2020 at 6:43 PM Manish Mandlik wrote: > > > > Check current scan state by checking HCI_LE_SCAN flag and send scan > > disable command only if scan is already enabled. > > > > Signed-off-by: Manish Mandlik > > --- > > > > net/bluetooth/hci_request.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c > > index 1fc55685da62d..1acf5b8e0910c 100644 > > --- a/net/bluetooth/hci_request.c > > +++ b/net/bluetooth/hci_request.c > > @@ -998,8 +998,9 @@ static void hci_req_set_event_filter(struct hci_request *req) > > > > static void hci_req_config_le_suspend_scan(struct hci_request *req) > > { > > - /* Can't change params without disabling first */ > > - hci_req_add_le_scan_disable(req); > > + /* Before changing params disable scan if enabled */ > > + if (hci_dev_test_flag(req->hdev, HCI_LE_SCAN)) > > + hci_req_add_le_scan_disable(req); > > > > /* Configure params and enable scanning */ > > hci_req_add_le_passive_scan(req); > > @@ -1065,8 +1066,9 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next) > > page_scan = SCAN_DISABLED; > > hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, 1, &page_scan); > > > > - /* Disable LE passive scan */ > > - hci_req_add_le_scan_disable(&req); > > + /* Disable LE passive scan if enabled */ > > + if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) > > + hci_req_add_le_scan_disable(&req); > > > > /* Mark task needing completion */ > > set_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks); > > -- > > 2.27.0.rc2.251.g90737beb825-goog > > > > Reviewed-by: Abhishek Pandit-Subedi Reviewed-by: Alain Michaud > > -- > You received this message because you are subscribed to the Google Groups "ChromeOS Bluetooth Upstreaming" group. > To unsubscribe from this group and stop receiving emails from it, send an email to chromeos-bluetooth-upstreaming+unsubscribe@chromium.org. > To post to this group, send email to chromeos-bluetooth-upstreaming@chromium.org. > To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromeos-bluetooth-upstreaming/CANFp7mXDvdicvyEpU-oDu4fBj92nQ7SENVdd_rG9TFQkqDevZg%40mail.gmail.com.