Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1159106pxp; Sat, 12 Mar 2022 03:25:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4GewnNlyH2zBSu3NaAMRON8olKGLPA9sSG4vMAlZ4pQIwIC0bnq4P+LB0QvFR9OmWhzch X-Received: by 2002:a17:906:c114:b0:6d8:cfd4:f746 with SMTP id do20-20020a170906c11400b006d8cfd4f746mr12025280ejc.538.1647084305282; Sat, 12 Mar 2022 03:25:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647084305; cv=none; d=google.com; s=arc-20160816; b=P4sIxaTAlJLU/rPoEmxYfhtZ2X6qC/tPfg2LYiZAnBu/LMHgl9tixiF9lfQCUkxgfD BYT2105ZYdACZ+Eae2mq57m9hPxINSDpRrOZK8veotbJLR8zyayupOJ6JNPa9NYwh8+P CG96JBPY4oC2WYuPKV5Ac5NAZuFDzYBQSs7NFE4XC4IbHLrH1PJ5/vxN0+CGXwNh4dB+ 1TP1oaJqqhpx2FsNKyiXthixG+6+fRLsD04c8dpDHCxBvVa3yVKFCaUq0C972Y2Rwpsl vsYG3kadCD38jW4KGJFXZcu2AJR1FnRy8mn+3lDEtaVKXsDciK34Vq3MMFnvWYNMIBv9 Gysw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=v0INzGgR4QVffzC6zq3G/Euc0szlm+qrGZcoVeZG7VQ=; b=mu9rmLqwIJsFxpLh6ar344mjJFltKkDZ8uTaE5qCZZ9+bZx4ojy7VmwI9sM2TzjCBe UTN6yp2DH68K+K/wFdbzSjmlOPLrJosfs2JX4xs6056bzOVq9hVo3lELpk2J3u6u33JZ GYPh5MMyr3kofRMTaVEmp7Za+Psu9iEvic0jtzWiqznsTgaIhZ5hvcOpZOB3lE2O3fPQ PY+wtYGp7LtZfOMCkp9Tqg04oT+AfVQQ+yzNzK6v+HOCA4rJaqGi/JNJ01C47fqpR7zH 8viGXEBaUYGmuy5q8ApfEPdr/jM9i+U2e3zjMJFxgDjQBGt3l7IgH+143KtlKjvXzFYa vqLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ShszOJyZ; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v12-20020a50c40c000000b004185267d8casi1644300edf.31.2022.03.12.03.24.23; Sat, 12 Mar 2022 03:25:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ShszOJyZ; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231687AbiCLKKU (ORCPT + 99 others); Sat, 12 Mar 2022 05:10:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231528AbiCLKKS (ORCPT ); Sat, 12 Mar 2022 05:10:18 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF37B226C37 for ; Sat, 12 Mar 2022 02:09:13 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-2dcd6a5e4b6so90055947b3.4 for ; Sat, 12 Mar 2022 02:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=v0INzGgR4QVffzC6zq3G/Euc0szlm+qrGZcoVeZG7VQ=; b=ShszOJyZjdPPLb5B4ng5mZ6noaksydnRNmBc5T8kVfAiGIFOSDc0SuvjuGA4RfYLJU vKu4zUJduKDBH2q1hDlkW9E2n9VlaRNkcFrdjmYNf3DEAo4fRm7Cw4lwWLLvMYbX1gvx AiJL2pyQZD90I7DnnpI+po/up1t6XtjJ4zo9LQ1HEi1xDNb9K8dge6a/nkQokgQEfbEE Y1G+Xb+j6F3RAtO4TWJ7jpy0mEmSbgjehIQp3tB7wI3rE8fwXd1HIptIIdYQOytkl/Bz ZBQVt2kSEY8YQ9FDSUbTr5K5gKVK7uRyFVc3Ut1dmFKaTV285BxcIu6okv0YnNHoP9xP W+eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=v0INzGgR4QVffzC6zq3G/Euc0szlm+qrGZcoVeZG7VQ=; b=8DskCa8MwQKjVT98awU+/Y6+zvJUPK5c//Kt7dsUu+bu1WYbMz3DsKANGwW3CtQ9nA Ht/PgkWwKF+kLFkGYGQoxl+dcNZYLN8CaNf9N60tMKWUUSTjrLKReijJzDu/AiwbUbsY YLFCEOkZQBz/Mk/rGCVIMggbFOTVzhjfzLFWfHPSQEbbNuWMVBgQQPn0EhvXfzEoiQah aJXzFryeTisEFxDTGeHPxS0nS8+SVS49VLQ8LzCbn+XgzSp/Zwr1x6D+MN6F1pRfVRXe jElC9owjoX1gH6mmLVAxbP1b8gzthDIPTTaGu/nbRSwj6OUYaiizFQWNf1N00II6oBrv 6naw== X-Gm-Message-State: AOAM530liH7OQE6Cb8942H8oi1v8MWktPV7BtXjEuElnBodv8OoqLKp4 33C9oxEEWOO3QepKj1xGoXsrJ72p8gtS9A== X-Received: from mmandlik.mtv.corp.google.com ([2620:15c:202:201:1cf8:bbfc:56cd:c500]) (user=mmandlik job=sendgmr) by 2002:a0d:d6c2:0:b0:2dc:a9b0:d22 with SMTP id y185-20020a0dd6c2000000b002dca9b00d22mr11818901ywd.194.1647079752865; Sat, 12 Mar 2022 02:09:12 -0800 (PST) Date: Sat, 12 Mar 2022 02:08:58 -0800 Message-Id: <20220312020707.1.I2b7f789329979102339d7e0717522ba417b63109@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.723.g4982287a31-goog Subject: [PATCH 1/2] Bluetooth: msft: Clear tracked devices on resume From: Manish Mandlik To: marcel@holtmann.org, luiz.dentz@gmail.com Cc: chromeos-bluetooth-upstreaming@chromium.org, linux-bluetooth@vger.kernel.org, Manish Mandlik , Miao-chen Chou , "David S. Miller" , Jakub Kicinski , Johan Hedberg , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Clear already tracked devices on system resume. Once the monitors are reregistered after resume, matched devices in range will be found again. Signed-off-by: Manish Mandlik Reviewed-by: Miao-chen Chou --- net/bluetooth/msft.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c index 9a3d77d3ca86..f43994523b1f 100644 --- a/net/bluetooth/msft.c +++ b/net/bluetooth/msft.c @@ -330,12 +330,13 @@ static void msft_le_cancel_monitor_advertisement_cb(struct hci_dev *hdev, /* Do not free the monitor if it is being removed due to * suspend. It will be re-monitored on resume. */ - if (monitor && !msft->suspending) + if (monitor && !msft->suspending) { hci_free_adv_monitor(hdev, monitor); - /* Clear any monitored devices by this Adv Monitor */ - msft_monitor_device_del(hdev, handle_data->mgmt_handle, NULL, - 0, false); + /* Clear any monitored devices by this Adv Monitor */ + msft_monitor_device_del(hdev, handle_data->mgmt_handle, + NULL, 0, false); + } list_del(&handle_data->list); kfree(handle_data); @@ -522,6 +523,16 @@ int msft_resume_sync(struct hci_dev *hdev) if (!msft || !msft_monitor_supported(hdev)) return 0; + hci_dev_lock(hdev); + + /* Clear already tracked devices on resume. Once the monitors are + * reregistered, devices in range will be found again after resume. + */ + hdev->advmon_pend_notify = false; + msft_monitor_device_del(hdev, 0, NULL, 0, true); + + hci_dev_unlock(hdev); + msft->resuming = true; while (1) { -- 2.35.1.723.g4982287a31-goog