Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1244590rdb; Sun, 7 Jan 2024 10:04:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTDrW8ChsXHTnpnwwO6ZkiXZgxgki/mQqjisCenU1sT4rQOXymAs3fg0P5c6PpPLJOl8AW X-Received: by 2002:ac8:5946:0:b0:429:7ddc:ecc4 with SMTP id 6-20020ac85946000000b004297ddcecc4mr4089365qtz.93.1704650639873; Sun, 07 Jan 2024 10:03:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704650639; cv=none; d=google.com; s=arc-20160816; b=MD10giNnLrNglJ1uQ30Ms35iuuSCIJ2mTO+7NABYLvTWz+auQQofL+fPWpxMQ6//WE xCYdbpHBr2B75hCY00sOMGgVq03ar+DxHuGyc0ZJMdveOS/B+Kin4rALt3ckNnbVXiKe f11NQakgbkR06cK8ITGfwUBYrBqXvNfRp6OjHgVNmXK7QRqMaqlXE+6ZjjX+gRCbmAgE 5gDp9xUaM1cdW4oS10DXHvpEeSc+HiPwGHM78usstjH0MqEYgfBtwjKZ8bTJrd4rlSYv 0QtfvaRpAcSN7BFyZmjhTUhvpOtJtUMQAiAPt+XzLxRnRB4aIzYfvnvdY4avJNM9tcdl fb1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=xFGvZRiDbQXjqxd2rppyOAzZOIsqJn9Ls1auXbQVx7s=; fh=S5rf2bc7VLlSXYQ0EqFAIodb1qEiUfsxulvZhQKZRws=; b=rhbXy/ehD7zjgmk+C7RiBFmMZsMOwSc1QZO1i5B7F5TuNKGZsSKTOAk5GXsIDvskVT 36MGvaE/5Rk5znjwgR83RmYD5zR3gCG/zBp8yaFPj7aMw0OQKyN+86U0jS5bBNmssBwE T4yI6BoT+4xG6ruChBUHg6XNmWOVnMoUBwC32ssFmfUPJyC3eKCPV6gQh8VKQ0AxX1rV 4jWpK21OE8kS3vv7SI2/YjiV60/v/kt/2nfpCRtHbC1dQ/QWylXzlzUx2/NEVxgtBpa1 0Hc2UjJdLrll3R3MfGZ7W6sorYR+DcPTozSvR68pPimFhf8Jvz8AA2ZvpTRMInIgEdSR 0pJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-938-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d13-20020ac85acd000000b0042830cf0979si6369358qtd.585.2024.01.07.10.03.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 10:03:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-938-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A0C7E1C2166B for ; Sun, 7 Jan 2024 18:03:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E423B14A9D; Sun, 7 Jan 2024 18:03:16 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80CB714273; Sun, 7 Jan 2024 18:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=v0yd.nl Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4T7Q603S65z9t8h; Sun, 7 Jan 2024 19:03:04 +0100 (CET) From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= , asahi@lists.linux.dev, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 2/4] Bluetooth: mgmt: Remove leftover queuing of power_off work Date: Sun, 7 Jan 2024 19:02:48 +0100 Message-ID: <20240107180252.73436-3-verdre@v0yd.nl> In-Reply-To: <20240107180252.73436-1-verdre@v0yd.nl> References: <20240107180252.73436-1-verdre@v0yd.nl> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4T7Q603S65z9t8h Queuing of power_off work was introduced in these functions with commits 8b064a3ad377 ("Bluetooth: Clean up HCI state when doing power off") and c9910d0fb4fc ("Bluetooth: Fix disconnecting connections in non-connected states") in an effort to clean up state and do things like disconnecting devices before actually powering off the device. After that, commit a3172b7eb4a2 ("Bluetooth: Add timer to force power off") introduced a timeout to ensure that the device actually got powered off, even if some of the cleanup work would never complete. This code later got refactored with commit cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED"), which made powering off the device synchronous and removed the need for initiating the power_off work from other places. The timeout mentioned above got removed too, because we now also made use of the command timeout during power on/off. These days the power_off work still exists, but it only seems to only be used for HCI_AUTO_OFF functionality, which is why we never noticed those two leftover places where we queue power_off work. So let's remove that code. Signed-off-by: Jonas Dreßler --- net/bluetooth/mgmt.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index d4498037f..c5291e139 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -9760,14 +9760,6 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, struct mgmt_ev_device_disconnected ev; struct sock *sk = NULL; - /* The connection is still in hci_conn_hash so test for 1 - * instead of 0 to know if this is the last one. - */ - if (mgmt_powering_down(hdev) && hci_conn_count(hdev) == 1) { - cancel_delayed_work(&hdev->power_off); - queue_work(hdev->req_workqueue, &hdev->power_off.work); - } - if (!mgmt_connected) return; @@ -9824,14 +9816,6 @@ void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, { struct mgmt_ev_connect_failed ev; - /* The connection is still in hci_conn_hash so test for 1 - * instead of 0 to know if this is the last one. - */ - if (mgmt_powering_down(hdev) && hci_conn_count(hdev) == 1) { - cancel_delayed_work(&hdev->power_off); - queue_work(hdev->req_workqueue, &hdev->power_off.work); - } - bacpy(&ev.addr.bdaddr, bdaddr); ev.addr.type = link_to_bdaddr(link_type, addr_type); ev.status = mgmt_status(status); -- 2.43.0