Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp308926imm; Tue, 15 May 2018 01:54:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqfwRpT6xn1Hx2QFYGSP4uRTsPmlqYs3CfrPfoMLLB403j4XJg1ko6L7G0tQ0wWv5wLLyxz X-Received: by 2002:a17:902:a5c7:: with SMTP id t7-v6mr13651887plq.360.1526374478834; Tue, 15 May 2018 01:54:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526374478; cv=none; d=google.com; s=arc-20160816; b=qDzK8qTCS3XkuoEXdioHnAVd3PB2D9GadoxfKhNxJM1UaiCXHZzN1qRSMqGkMF9s0E fwgvqctOQUYM4xs/B88LOUk65PjQ8o1XvzZwVPqLMyO2C4SnsHXokxJAsHoWtQGiJbTN bK1smI4a9j7pQgPRMiETIXZ9yNvDszazLHm5eL7BdIDfRkTVviZHuKQjHbZJXE6p/0bI V6mbV0xP5Vkn0S/L3T7qc7ImSCXJAr6D7kuo51N9OsEiHK70oQmG/QjPO/nGpRcoF9+o YCGqiG/KWhKD8Gj1Utrbi4HhvDWAoqv12VsSgsgAjnc0ojQDlqkPmVRh12WKCPK5JEv5 jURw== 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=QzM+CYgE8EhM3/lXImafIIG51fuebT6+fheo3ctiISY=; b=ll0/+vLOtEYGmaCbudklL6kMjmjZmb4DWKhoqqbk3Uj4+jqkfHU+qfyMQpjy+Len54 kAaqFlMuuy8dsW/OGjVqFv/SXxEr2M6pIganrMgfK+17tRFyr+srmATV0uhcEpXsZw32 DMTedvmpZo58xAHJNiHpKYLXjVRm8qhfy7tXNC//ukDYVPoCN3Z4RUfon9WK2jNuryvI UZaWAqzgrzaKm29cLZgIuXnuRH0PkTB4DcZkHbo4rqwfqnx8RCDbtBWEPpZSf9to96B3 KcVtsFVPBtpDx99dLhkGh3Ken7YlWFXFcsSEQemcz1xpIp0ldL9ojBOcu7o2lXk85IEk fWZA== 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 h186-v6si9025304pge.324.2018.05.15.01.54.24; Tue, 15 May 2018 01:54:38 -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 S1752647AbeEOIxk (ORCPT + 99 others); Tue, 15 May 2018 04:53:40 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:45654 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752568AbeEOIwl (ORCPT ); Tue, 15 May 2018 04:52:41 -0400 X-UUID: 99f8ddac2d454d1a9ea995f190fa9985-20180515 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 413306141; Tue, 15 May 2018 16:52:34 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Tue, 15 May 2018 16:52:32 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Tue, 15 May 2018 16:52:32 +0800 From: To: , , , CC: , , , , , Sean Wang Subject: [PATCH v2 4/7] Bluetooth: Add new quirk for non-persistent setup settings Date: Tue, 15 May 2018 16:52:19 +0800 Message-ID: <1d6097f538b3182b2876ad48225ecd6e2d1b128c.1526374087.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 1668211..b37d973 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 40d260f..7de712e2 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1377,7 +1377,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