Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1017956pxu; Wed, 16 Dec 2020 23:20:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmh1U+L9leVHbRWad+cuSX2V6SrIKYy96yKYTkQeIUyxde6xuZ4HoIMHhVRsqsNtxZm5Vl X-Received: by 2002:a50:ec18:: with SMTP id g24mr10054141edr.6.1608189626020; Wed, 16 Dec 2020 23:20:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608189626; cv=none; d=google.com; s=arc-20160816; b=gVHIxLp4FVZAeoq75lX3T24lzVsbawHwxkp/w2WwKP29+PRBjRpwFAW9QJFlFAtZFF T/dx68wUABN5TtK8qMicFjsXsgXIH555ZVRAhs66AoHLxwhI5mYZGUrqdOsS0XlltkRY OfnFGDYHaTYPbEfXMSxXtCzJPEWUxCEVz6uWshEGB62KUJXo8P+DxGfJL4RXuEhf7wJZ I9GTNUsIKpwVLFwW3wHfAP4aofIOwNUMlRiDEp4iGrOekh9BPoQtpm9oalS6jqQYFZZB S5wVipL3CO2Vb6eBIxds1BxRNc4+jxuD/YJPR66BNm3C8jR8wuhvtr0ur2KCbSSe9TjL il9w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=TEO3/oQXoRDhA5Aynf5tOUBOZITapi4dUktMPWEGVZE=; b=rRshYIItxLSj/+b1riwS8YMODuNocpXR/P1Ke6E/UPvL9ZeWgTFnYMIfHjBvSaGZgQ 65qkQonKhat/ZTXOuv23s7uVzVbGNSHMyoQycI/ApADG6/487f7XQFisAdm8B3SLCNRN b7oqSZR/+hBRlQun9IiBgIbc0SO1O72MYPNrJf3Tfcuw6l+c3FFL+mbN8yyQECAGXFqC l8XqZG2Qk5rrJhTvX6gSIuGPpRkHLdcoO9gwpFr6OzA5O7yySiRK895Spr0rO22fDD9e vVWMWN7+Aaqk5kVZ02d0z39zLugVMKgW+eXBuax0B//JO83bWIlDyjobnGMtf4PGfA2Q BUJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="ndhZNq/p"; 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 dt1si2595737ejc.558.2020.12.16.23.20.03; Wed, 16 Dec 2020 23:20:25 -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="ndhZNq/p"; 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 S1727012AbgLQHSZ (ORCPT + 99 others); Thu, 17 Dec 2020 02:18:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbgLQHSY (ORCPT ); Thu, 17 Dec 2020 02:18:24 -0500 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62BCEC061794 for ; Wed, 16 Dec 2020 23:17:44 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id n10so11679681pgl.10 for ; Wed, 16 Dec 2020 23:17:44 -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:mime-version :content-transfer-encoding; bh=TEO3/oQXoRDhA5Aynf5tOUBOZITapi4dUktMPWEGVZE=; b=ndhZNq/pSBaAgASPaZht6Nko7YjlzT6/xcqnnYlTyx6Yzm41/zdeDh2EXZOVRR8jOU L6jYs1DdTbipR0GET9I8bg6eOds5218HKB8ugQgwO1v0QJMjeVeuIy4L8tiJN5v56VcL 9jW6pcdLX16EGoR01wxXTe2H4BP6IELYAp5gg= 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:mime-version :content-transfer-encoding; bh=TEO3/oQXoRDhA5Aynf5tOUBOZITapi4dUktMPWEGVZE=; b=VM0yCac3f7wwkmsfGlcrvlDqjBRhVFne7PNhjg33WQAH24xah+oTZlhUMpRkWw1pVP gSDjOQ/w98kulShy67eAtDdtu6YUhT3Aht4VKJ1ZWlQz4dgsZVo1YDflPOhNsz8g1mbj 5ZSRMQrDxUuV//JA2OxXRPwbTecidFkt4PId0CdudgR/mexq1cElcrY+i/tkllipLfqJ 8WzJQCBPEQLy7waNtF81vk/Ke5SRxew9HkSgvQRvC71HJZa0bpUWG4R6DlgAgHGPeWXQ 8pIkvACjVk9lI2As6TA6yVBdXK/jSLCpDw4k34zjdoUNvsVBPOgjJSUIDEqVHXSb1W3h RlWg== X-Gm-Message-State: AOAM531UiTpsfDbL8X6n/5OLKz207B41Z8yaIs67e+PsrEmhA8VyweNz Nh5qK32mfXuGTTBcpUpk8E+qDQ== X-Received: by 2002:a62:1716:0:b029:19d:b78b:ef02 with SMTP id 22-20020a6217160000b029019db78bef02mr8043307pfx.11.1608189463855; Wed, 16 Dec 2020 23:17:43 -0800 (PST) Received: from localhost ([2620:15c:202:201:de4a:3eff:fe75:1314]) by smtp.gmail.com with ESMTPSA id q26sm4723632pfl.219.2020.12.16.23.17.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Dec 2020 23:17:43 -0800 (PST) From: Miao-chen Chou To: Bluetooth Kernel Mailing List Cc: Alain Michaud , Archie Pusaka , Marcel Holtmann , Luiz Augusto von Dentz , Miao-chen Chou , Abhishek Pandit-Subedi , "David S. Miller" , Jakub Kicinski , Johan Hedberg , Luiz Augusto von Dentz , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v1 1/4] Bluetooth: Keep MSFT extension info throughout a hci_dev's life cycle Date: Wed, 16 Dec 2020 23:17:27 -0800 Message-Id: <20201216231652.v1.1.Id9bc5434114de07512661f002cdc0ada8b3d6d02@changeid> X-Mailer: git-send-email 2.29.2.684.gfbc64c5ab5-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This moves msft_do_close() from hci_dev_do_close() to hci_unregister_dev() to avoid clearing MSFT extension info. This also avoids retrieving MSFT info upon every msft_do_open() if MSFT extension has been initialized. The following test steps were performed. (1) boot the test device and verify the MSFT support debug log in syslog (2) restart bluetoothd and verify msft_do_close() doesn't get invoked Signed-off-by: Miao-chen Chou Reviewed-by: Abhishek Pandit-Subedi Reviewed-by: Archie Pusaka --- net/bluetooth/hci_core.c | 4 ++-- net/bluetooth/msft.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 9d2c9a1c552fd..8471be105a2ac 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1780,8 +1780,6 @@ int hci_dev_do_close(struct hci_dev *hdev) hci_sock_dev_event(hdev, HCI_DEV_DOWN); - msft_do_close(hdev); - if (hdev->flush) hdev->flush(hdev); @@ -3869,6 +3867,8 @@ void hci_unregister_dev(struct hci_dev *hdev) unregister_pm_notifier(&hdev->suspend_notifier); cancel_work_sync(&hdev->suspend_prepare); + msft_do_close(hdev); + hci_dev_do_close(hdev); if (!test_bit(HCI_INIT, &hdev->flags) && diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c index 4b39534a14a18..d9d2269bc93ef 100644 --- a/net/bluetooth/msft.c +++ b/net/bluetooth/msft.c @@ -76,7 +76,8 @@ void msft_do_open(struct hci_dev *hdev) { struct msft_data *msft; - if (hdev->msft_opcode == HCI_OP_NOP) + /* Skip if opcode is not supported or MSFT has been initiatlized */ + if (hdev->msft_opcode == HCI_OP_NOP || hdev->msft_data) return; bt_dev_dbg(hdev, "Initialize MSFT extension"); -- 2.29.2.684.gfbc64c5ab5-goog