Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2810057pxu; Mon, 7 Dec 2020 16:53:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwW8TiJQv7XUuI+TBVHEkLa/ej9B8yPyT6QYRPQGMvIo3ogc+9KsnkU0niBEbRT7SkNJmoD X-Received: by 2002:a50:8b66:: with SMTP id l93mr10030942edl.384.1607388786006; Mon, 07 Dec 2020 16:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607388786; cv=none; d=google.com; s=arc-20160816; b=Y3lKGGuYvptwIDaFTc7V9vvgLPO7A/ZdqrbzxMm/m+iKtC/J+uTUMktmk5HSavL1b5 Z/P6VpvXOvwVYiufKy/vhIOVgM2wCUspQK6qbgf13FL1EQsVdqCfLIMdl8doN1KzCxm3 XL5eGnE/DqJAgmd6E96k1lhX5t461ti3PdryeNDLYZlEezHTYKQxXDgczXxu6EEVgvHp 0DquEKxwyIJjGswXpIcmeatKvDgnG+HZebw+tei9NFlj/dMljMYQwITHwxn7uTseGcQ4 iD6FRZ95Grv/fXVvI+qo9IdXQBYWlPWIOZ/nuz399Kv2lzN/rYwfS1BYvMEiIcNbQlhk b9XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OZPKJ8iyX4JiTuKS52IveePlvykbl+yKfx0dWwq1kK8=; b=HNV98fLXyFYdwMsoh+ctJ/pFplx9bxKqS2oht7qB3e+RzsPRP98DeZHV9cdjsbY5FH +LbqsyoNaRXiATxNJ9Ru1AhBYOEIGyjy4L1INNRmMu4KRqygxGKOnT+EqfxPbLe/V2EK ualkzQwgwo2GveUTRFqK2I80MdseXsHIq0Nlih0amDKPxqiiRB1g4189J4nnZjuVLJor 1t43sDLYOPPfVwskYCz8/lQSqiJUAb/K/QbPFXtDoHrzoVt2ffy8f7Lyei+rR2BdqwVq oers1J1JqNHdqwzhKXeadVoU0u8spTdR4vfa66/rZl3g/LG8yEXdBEw/zkjyPOeiDXDu B4Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lmsv5Gu9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si9159500edr.372.2020.12.07.16.52.43; Mon, 07 Dec 2020 16:53:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@chromium.org header.s=google header.b=lmsv5Gu9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726326AbgLHAN6 (ORCPT + 99 others); Mon, 7 Dec 2020 19:13:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728448AbgLHAN6 (ORCPT ); Mon, 7 Dec 2020 19:13:58 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0156BC0617B0 for ; Mon, 7 Dec 2020 16:13:17 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id t37so10545664pga.7 for ; Mon, 07 Dec 2020 16:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OZPKJ8iyX4JiTuKS52IveePlvykbl+yKfx0dWwq1kK8=; b=lmsv5Gu9va9hMa7bt7nSxlp+wA8AgcilngVtUiJdSp58LhtJNevUH3Ef6fRHF6qQUD b48sd+v3vN4yKTbINTv4QVGxnf0dDzYTRGTaMOUPzqt6WJLnmAwT5WqnQl394pj+jCRb s9XL0FalTQHLIB/+xsUt2QR50a2TM+xUfX4Dc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OZPKJ8iyX4JiTuKS52IveePlvykbl+yKfx0dWwq1kK8=; b=erBFIklHOPO5zA3crhX5AIZNvAU9nU7FV4+sSe2YnY2OfvQk7PEq5jTkt8S5b28ssx 1w/M1Z596DWbD17q4w/R1VuZCsaI8Ny93alPdVWaE8wJcQMy3mRbDm5tekiv++9+SEvo vLCLcj7nLbMkewQ2Ky/1agaazp6AUgxDHQr76RlHxEx/qBYMItb9888m7YW8e0mlAQmg pqiVglk/7B2+P5W+j39agjsa/Dkp2qigQuM7C/s2mDzBZ9rJkx3VQq2EfOIVgdpeddN7 TX3uKb535H3iMLlNDSNVhUW26aSL7/ywGKwEXpyJfTGe83+II64xpAcnPwm4pzeyWtM6 AmkA== X-Gm-Message-State: AOAM530RslCvPMFPV7o69sTM7zJBZY18g2yC1IfIGtAEp2wa76I2J7+x ZbgjxZ2EFhZjBS9gk6/QFoGFIQ== X-Received: by 2002:a17:90a:6a48:: with SMTP id d8mr1247629pjm.130.1607386396602; Mon, 07 Dec 2020 16:13:16 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:7220:84ff:fe09:2b94]) by smtp.gmail.com with ESMTPSA id v8sm514214pjk.39.2020.12.07.16.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 16:13:16 -0800 (PST) From: Abhishek Pandit-Subedi To: marcel@holtmann.org, linux-bluetooth@vger.kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, Abhishek Pandit-Subedi , Alain Michaud , "David S. Miller" , Johan Hedberg , linux-kernel@vger.kernel.org, Jakub Kicinski , Luiz Augusto von Dentz , netdev@vger.kernel.org, Howard Chung Subject: [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config Date: Mon, 7 Dec 2020 16:12:54 -0800 Message-Id: <20201207161221.1.I94feef9a75a69b0d0c7038d975239ef3b1b93ee6@changeid> X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog In-Reply-To: <20201208001254.575890-1-abhishekpandit@chromium.org> References: <20201208001254.575890-1-abhishekpandit@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a missing SUSPEND_SCAN_ENABLE in passive scan, remove the separate function for configuring le scan during suspend and update the request complete function to clear both enable and disable tasks. Fixes: dce0a4be8054 ("Bluetooth: Set missing suspend task bits") Reviewed-by: Alain Michaud Signed-off-by: Abhishek Pandit-Subedi --- net/bluetooth/hci_request.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 71bffd745472043..5aa7bd5030a218c 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -1087,6 +1087,8 @@ void hci_req_add_le_passive_scan(struct hci_request *req) if (hdev->suspended) { window = hdev->le_scan_window_suspend; interval = hdev->le_scan_int_suspend; + + set_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks); } else if (hci_is_le_conn_scanning(hdev)) { window = hdev->le_scan_window_connect; interval = hdev->le_scan_int_connect; @@ -1170,19 +1172,6 @@ static void hci_req_set_event_filter(struct hci_request *req) hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); } -static void hci_req_config_le_suspend_scan(struct hci_request *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, false); - - /* Configure params and enable scanning */ - hci_req_add_le_passive_scan(req); - - /* Block suspend notifier on response */ - set_bit(SUSPEND_SCAN_ENABLE, req->hdev->suspend_tasks); -} - static void cancel_adv_timeout(struct hci_dev *hdev) { if (hdev->adv_instance_timeout) { @@ -1245,8 +1234,10 @@ static void suspend_req_complete(struct hci_dev *hdev, u8 status, u16 opcode) { bt_dev_dbg(hdev, "Request complete opcode=0x%x, status=0x%x", opcode, status); - if (test_and_clear_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks) || - test_and_clear_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks)) { + if (test_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks) || + test_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks)) { + clear_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks); + clear_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks); wake_up(&hdev->suspend_wait_q); } } @@ -1336,7 +1327,7 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next) /* Enable event filter for paired devices */ hci_req_set_event_filter(&req); /* Enable passive scan at lower duty cycle */ - hci_req_config_le_suspend_scan(&req); + __hci_update_background_scan(&req); /* Pause scan changes again. */ hdev->scanning_paused = true; hci_req_run(&req, suspend_req_complete); @@ -1346,7 +1337,7 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next) hci_req_clear_event_filter(&req); /* Reset passive/background scanning to normal */ - hci_req_config_le_suspend_scan(&req); + __hci_update_background_scan(&req); /* Unpause directed advertising */ hdev->advertising_paused = false; -- 2.29.2.576.ga3fc446d84-goog