Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp693970imm; Mon, 9 Jul 2018 08:59:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcb9FcQBeh9cDjYCp01cJ1F8pgM6WbrC0jdTZ51u3UDYvjmz0qU4Hmr2WOslgEJA1F8pw2r X-Received: by 2002:a62:9cd7:: with SMTP id u84-v6mr5082175pfk.90.1531151979149; Mon, 09 Jul 2018 08:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531151979; cv=none; d=google.com; s=arc-20160816; b=UzWz8YmJbs5tI0MJleYzjN7d67zg11M8xJ2i+LECMDY1RiGveJGV/A5XzAVDck1eq5 Ln6WMM3mg3bfXjd5H2/XVjW0Bdq4r+NMlbJcatbKHFgkFcibVccbksZxWm5w4RJRag9A rxafyUUD2YvGtzyU/eLVZX+a1HSul8hlk7dk0uvbwyqO11ENPis1BR1VegQdAcNnY9Yd mEm1NFykBMcIuTYMu4tCf0vJ0sVNr/G0gsu40VQ0FOeSmMMn6kfakjZC8uMZPDBdqedo /O9c6gYCF74Nq4CRe0NRAJeykoUc/GGoQ1iPn3A0BwQcgMpwvH0mEBUHva6Gsw1/0Xm4 /SMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=Q/0BzXaDkM3+VoTe7EXnLmZ6Ri9AXx/vztiHxHNhxqE=; b=cwRihY+GFBpPeihRfkczneVhpMBQw7NfESLJDmhOvMl/kN5MRfrNWzbfv5ZHbX3MRa /3IP1hAcukthLwTSn+ZflJZrHsERBp1gkZcGNmpvW5VNhg3GlQ4fK17PnNdH3Si/YIKa Bsosc5UuZNX4Uo/KOntk1ol+jbCDF1dqsj3lFk4ZJRe9SGOA6feRpLLtZFiA8cDa8B9Q RpHj/g9I5IEImk/+juayAxcyvrNEaHGJpSji9DEsMaT93vIeYfQLYwo2007YlmBHkwus Sc8XVMFVYxLMyiBTcs4RNKpKDPFnXNpEB8KOMv2130INvvTbwFtJafQy1KXUVT+pXt1e R1Tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m141-v6si16012315pfd.310.2018.07.09.08.59.24; Mon, 09 Jul 2018 08:59:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933984AbeGIP6A (ORCPT + 99 others); Mon, 9 Jul 2018 11:58:00 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:17430 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S933837AbeGIP5M (ORCPT ); Mon, 9 Jul 2018 11:57:12 -0400 X-UUID: 27dd1c15aa314b75830bfa2523fb20c9-20180709 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1161735204; Mon, 09 Jul 2018 23:57:07 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 9 Jul 2018 23:57:05 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 9 Jul 2018 23:57:05 +0800 From: To: , , , CC: , , , , , Sean Wang Subject: [PATCH v5 4/7] Bluetooth: Add new quirk for non-persistent setup settings Date: Mon, 9 Jul 2018 23:57:00 +0800 Message-ID: <4b188c8a508340598dda233f6d49a16c9ac8784e.1531150733.git.sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Wang Add a new quirk HCI_QUIRK_NON_PERSISTENT_SETUP allowing that a quirk that runs setup() after every open() and not just after the first open(). Signed-off-by: Sean Wang --- include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 73e48be..d3ec5b2a8 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -183,6 +183,15 @@ enum { * during the hdev->setup vendor callback. */ HCI_QUIRK_NON_PERSISTENT_DIAG, + + /* When this quirk is set, setup() would be run after every + * open() and not just after the first open(). + * + * This quirk can be set before hci_register_dev is called or + * during the hdev->setup vendor callback. + * + */ + HCI_QUIRK_NON_PERSISTENT_SETUP, }; /* HCI device flags */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index f5c21004..0111280 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1396,7 +1396,8 @@ static int hci_dev_do_open(struct hci_dev *hdev) atomic_set(&hdev->cmd_cnt, 1); set_bit(HCI_INIT, &hdev->flags); - if (hci_dev_test_flag(hdev, HCI_SETUP)) { + if (hci_dev_test_flag(hdev, HCI_SETUP) || + test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) { hci_sock_dev_event(hdev, HCI_DEV_SETUP); if (hdev->setup) -- 2.7.4