Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4465829rwb; Tue, 6 Sep 2022 07:57:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR535oG9Is9CZ9ePB+1hIQ+eS9ViDrST2blzZcsq7icOCc/TdZ/HgbwNL8a2J7egVZNBFoBO X-Received: by 2002:a65:46c4:0:b0:41d:e36b:1e59 with SMTP id n4-20020a6546c4000000b0041de36b1e59mr45935458pgr.494.1662476258807; Tue, 06 Sep 2022 07:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476258; cv=none; d=google.com; s=arc-20160816; b=psF+5yjWuK0s59wHtd2SI0lSXCKCDDKrd/wIvscYrn12Uhhg+Pn7Y/KMtyOTD6sfWC kOo0ldphUwu8JvuoZCPZ61Zl49qK1GfmWOa+6BBrs5KZYbAcnF4eRvmw+f+YBu4GFshg D6m+GgkwEshPG5BbfGLZqMgfvr0NNx9L6gChmlDsMMf/vjIBCguU4q+M4DKDkJkeIIcV 0tghWFIZUYQGJAp+bYmfZ9Gy0AfwJy3uaXNmcrvm40HtThb/WpAlcYrne2IneFaNDnbo 5d2Akmz5YdOtW/W620zxxPoUrnICwzU50Qa90kwX8n3HcQdUGmaKzoN5edXRCnGzKDzo tN9Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qWMVxDMtxJF4QvTBE/DvW363f6bWr9+dWKXYUeNDft0=; b=UIwqmRXkiEy/gM+842kurmaLoRKTUohV9jR0SNa9h8XRfKl15k+Vszpw47bDP9vKu1 kzWWQdV6IA9rf38tLSXUNmS5E7OcjmmwG3d9aGy9Vl2NXmcKDWWXRMPHdNGDD8YBwLs3 LLBbidItdUrTs/XcbsCVOUiaGLynSt7shJg+w89gcysjmiJNGO69Wsv0cHxCN/yBfwJd u/MhA+b8OLxEOJ/vduCve1bRhXIIvf81qu8HdJEsYKSWEmmmstiAXWoXHJ2KVRdUMKGe zQPhSsEUx3zCskKvGAuiHj2f2wV/YFmT+3TURsJjucCxC42/3owM/85NOFGEhq+LMUQ5 qPcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rV06rkS9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e2-20020a17090301c200b00176e16b0c58si160124plh.21.2022.09.06.07.57.27; Tue, 06 Sep 2022 07:57:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=rV06rkS9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240889AbiIFOCp (ORCPT + 99 others); Tue, 6 Sep 2022 10:02:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240983AbiIFN7Q (ORCPT ); Tue, 6 Sep 2022 09:59:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF4A983062; Tue, 6 Sep 2022 06:43:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7CCEE614C9; Tue, 6 Sep 2022 13:42:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F618C433D6; Tue, 6 Sep 2022 13:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471767; bh=RgwTp/+6L4fw8BFVer85uyI+oumLirHMGkUf5M0yMcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rV06rkS9NwJmo3/T5N2N2roBhyQB9bg8TXxP75iXGpLe3mINt6B/pJ5LlyQUd3gTe vI8J9h4jqRSQLMAqjxFJ+aeI+q21pv6mJMak6XA7Pr8+yKh/+yjltOIUiRAY0F9j2G n2IHPp06PdgzZcOmEzdHD0ajpTMDkNxr+C1/XgQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.19 030/155] Bluetooth: hci_sync: Fix suspend performance regression Date: Tue, 6 Sep 2022 15:29:38 +0200 Message-Id: <20220906132830.696125381@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org From: Luiz Augusto von Dentz [ Upstream commit 1fd02d56dae35b08e4cba8e6bd2c2e7ccff68ecc ] This attempts to fix suspend performance when there is no connections by not updating the event mask. Fixes: ef61b6ea1544 ("Bluetooth: Always set event mask on suspend") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/hci_sync.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index b5e7d4b8ab24a..2012f23158839 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -4967,17 +4967,21 @@ int hci_suspend_sync(struct hci_dev *hdev) /* Prevent disconnects from causing scanning to be re-enabled */ hci_pause_scan_sync(hdev); - /* Soft disconnect everything (power off) */ - err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF); - if (err) { - /* Set state to BT_RUNNING so resume doesn't notify */ - hdev->suspend_state = BT_RUNNING; - hci_resume_sync(hdev); - return err; - } + if (hci_conn_count(hdev)) { + /* Soft disconnect everything (power off) */ + err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF); + if (err) { + /* Set state to BT_RUNNING so resume doesn't notify */ + hdev->suspend_state = BT_RUNNING; + hci_resume_sync(hdev); + return err; + } - /* Update event mask so only the allowed event can wakeup the host */ - hci_set_event_mask_sync(hdev); + /* Update event mask so only the allowed event can wakeup the + * host. + */ + hci_set_event_mask_sync(hdev); + } /* Only configure accept list if disconnect succeeded and wake * isn't being prevented. -- 2.35.1