Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1633863pxu; Thu, 17 Dec 2020 15:01:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJw83lluQqb7f5z5J/48iUK/MLgjfnzyhB62BcQjm5ZVBDOwvOzc5G2TrkoaAiMhXgqiW6SL X-Received: by 2002:a17:907:4271:: with SMTP id nq1mr1306096ejb.358.1608246071078; Thu, 17 Dec 2020 15:01:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608246071; cv=none; d=google.com; s=arc-20160816; b=f04DYEKnG+dW++5JiBQsgm2I+38bK/NS58yc0vMlu5UOL2A23sEeY33c5oHzBu4rmn UVhuS4Gg7iStlaLVxCJ/wToXMNBN0sL4C6ye8HHi6hmY4MxtKOd0or8D+kpp5o9mCZg7 EDkSi86kD17dPkdfujT3mqQembgpURsV95wu8upDAhykyx9g9otwYIVFWRJbk0AirI+J c/lhbeyQd2xBX+pF3e6JJmB3EaIvTapU+vMwEGTChKx5dEfxWpAzEhVxeD8RE+aDoo7R ytrhcpBW01MMEv5xuMn2eCXnPxyOujEXGW241A6ouY/idaJtIiwU1yPtVCGOCktqbHca /RMA== 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=fRqpnsxfl7qHr4VGqHrEfBZUN2xnW4XoVy0GlNX3IEw=; b=ukwlW32AODmBdklFHww90s0GdIwxw0s6NLao90wvM1fyLnq82G5XzgVgyOhzGkb1hm Eoq16YRpK6OcTmuNiMnMIcEXhrC3bbU/cYiIlcSX+5uaISkS+J3Wr9Kue+W9f8cQEnos f1Hb8NSvDTm1Vi32PZsaXPK56iqu6eB4amOAH4P4VMLQTmbpJN8DtsPx7zTxOLyEwtDR /modPiys95tpG5YwdSkisT6EakNJrPYUdohANUhLHCQV859LiDzYzk2Kq+M66Gis6Lno 859OT/qYbpkvGZrqkkc9sRnKstqdDhp6ZUfJHJwW92ICtB2GcZuKWa0JqFzzLjhZuphl rOgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=M7tyJ75Z; 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 s18si4231536ejd.607.2020.12.17.15.00.48; Thu, 17 Dec 2020 15:01:11 -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=M7tyJ75Z; 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 S1732090AbgLQWyS (ORCPT + 99 others); Thu, 17 Dec 2020 17:54:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726796AbgLQWyS (ORCPT ); Thu, 17 Dec 2020 17:54:18 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53C9BC061794 for ; Thu, 17 Dec 2020 14:53:38 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id e2so108226pgi.5 for ; Thu, 17 Dec 2020 14:53:38 -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=fRqpnsxfl7qHr4VGqHrEfBZUN2xnW4XoVy0GlNX3IEw=; b=M7tyJ75ZEoEHtHRFHXWzjAukeGU6uZWu4hbrVNbxb4pviOUrB3bQahQtCfSC+9p2m0 YDbKmXSabg6qZDYR7dqyDdhad3kdv7qLeVSxCaRhSh8fTvXp8w00pJZo8oMSmq2YxgXl fNBAwH8sxrhgbeSxvMpB24u/EOf+k1SOiNXGw= 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=fRqpnsxfl7qHr4VGqHrEfBZUN2xnW4XoVy0GlNX3IEw=; b=uT+kNxRyaKBTZ5M8RSANKajUbeYHtbuIl3CwJNJMrtQqWaWX09B5aP3YfoUmZSZnne iCuaWjF80W6IMweziG1w38QMmH9K4Rb9/PZRdHxr+mlC7J2v9tE6X2y8Da1OaP4SFaCd iKCaoJPXo4ZZcGVNVsJ3jMFjVpNLDnqTgnTMKcYWMUc2jcleLZrzII028FfqFjX5nMdn S51+uoXRnO8EwBEL21Wa7uQUXMxjtIvVJT7w+DUBSIRF/G4Hgz6OLLMe2MeSwpnb9H8J aT5qqSE97xkuDLC2tPNJ30P0IOya7qZCZFojd3uYDrri55CU9NKAI+wZ7v4L8hgmsypC 9qDg== X-Gm-Message-State: AOAM5328lOBXS6wkNLkDIUJnDviWRWN+RCqxW3YB1AuIuNbStyHxXBu9 NTmAakMMJIkoOwNAY45hC4ykTg== X-Received: by 2002:aa7:8701:0:b029:19e:561:d476 with SMTP id b1-20020aa787010000b029019e0561d476mr1477814pfo.2.1608245617759; Thu, 17 Dec 2020 14:53:37 -0800 (PST) Received: from localhost ([2620:15c:202:201:de4a:3eff:fe75:1314]) by smtp.gmail.com with ESMTPSA id c14sm6559544pfd.37.2020.12.17.14.53.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Dec 2020 14:53:37 -0800 (PST) From: Miao-chen Chou To: Bluetooth Kernel Mailing List Cc: Alain Michaud , Luiz Augusto von Dentz , Archie Pusaka , Marcel Holtmann , 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 v2 1/4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Date: Thu, 17 Dec 2020 14:53:15 -0800 Message-Id: <20201217145149.v2.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 --- (no changes since v1) 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