Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5985071imm; Tue, 26 Jun 2018 23:37:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfg3Of4XcKK0KP1rmwqzkJH2KAgbWMFYMfcn5uRF0l3aSWyh+/tU8NFzhjUX87AmChFAdKU X-Received: by 2002:a62:6f86:: with SMTP id k128-v6mr4628153pfc.150.1530081441595; Tue, 26 Jun 2018 23:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530081441; cv=none; d=google.com; s=arc-20160816; b=WR0LalSQp8X0HN9KpsMgaohehN8+OLCBtINE6FKkvqPXnbyK8Oadf+GARxdVIlnA3W vnCsvuBY1YxgTN+0WeFFFXJJNC0ve+tynNoUjDmTiKyntBODQTHhE411jDWKDJsLeIHN vt+nUnXof79OmRziX3gekwSe+WUvtgZehjYScn8/0zzkDzY+sp46gT/mkaypQ99A2B+T CounVODaDhqMZV9pXptqUrn2MjrUrQyQiDzhhpUaBu7qQrrv1RXpdug5+HuljuPJHJBP xCw/KW8v9VzkR/ao7ZGUuFdEFfkqAbiO2uhsNFAhd5dpno7ve+UFjKe3OxcFFdh8DEwp jvwQ== 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=H6vX4lxUXmoRQdOLppZAufmeLvvVekg91GUErhES1xQ=; b=YweXeuH7vBKClydH/aS/pvcdtDxX2PXaRFwLjwUuulUQwR9FU8W8rJsnNGzC+R+KqH mgkcfdQ8hHkk/y1QVK628D1QMC33p+YE7xLce8PI2oNT74y6QLYij+SRcPrvTt2l/Ey6 EJPMDMDaqMNH4YO0RKGp7/SLS2noLvca0e9RIWbiUn4qmyDFXU9LDvU3XRzS+zG1yiW5 MiyPdBmmWCHiHLJ/wupWdQ359S5XEsacHP/ISL+S0AfvlXa4RCBGiNGCP0z2Di7ILiVm d+x1ldpMjsk/ttdjMErgsBehDL6r7ehtnDuUIpbcr6RLWizLcKaCeOvf18d/MqfuU5pS FbNg== 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 bd3-v6si3128935plb.171.2018.06.26.23.37.07; Tue, 26 Jun 2018 23:37:21 -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 S1752989AbeF0Fno (ORCPT + 99 others); Wed, 27 Jun 2018 01:43:44 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:10904 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752495AbeF0Fni (ORCPT ); Wed, 27 Jun 2018 01:43:38 -0400 X-UUID: cb5f77a8b81849f280b239a4e3430a08-20180627 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 445409702; Wed, 27 Jun 2018 13:43:34 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 27 Jun 2018 13:43:27 +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; Wed, 27 Jun 2018 13:43:28 +0800 From: To: , , , CC: , , , , , Sean Wang Subject: [PATCH v4 4/7] Bluetooth: Add new quirk for non-persistent setup settings Date: Wed, 27 Jun 2018 13:43:22 +0800 Message-ID: <14b169297439e55751acde25f7224e65a089f042.1530004712.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 ee8ef12..f2bf0c6 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1368,7 +1368,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