Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1597547imm; Thu, 14 Jun 2018 00:15:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK+9dGB40RXJyR9eH6ruUqgnijuxCpoiGDyB/DsscijxZLasD/qFrBSmQkOtJQAKYpqhYGT X-Received: by 2002:a63:770c:: with SMTP id s12-v6mr1244756pgc.17.1528960533740; Thu, 14 Jun 2018 00:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528960533; cv=none; d=google.com; s=arc-20160816; b=oQ2BhIGJwL56+74DkmjCXis8grhTs5uwu3QLMs2/RVHxSwDhGjajnSXahQLRJrVJg2 7L84xcxmYQCUXW1r5GAn7yFzGodak/SyO9LTt32KcztIvvwgLsKk//yk3/gfYTAxhbNK N3Z/NL+ZdOCwU159NUZp5WoZK+J4WvdMgYcbsAQ1GH5F31mi8JHjypgnp3jXEWPEMggB QpcDsnDAqLvn8fymy/pZ7tZl/usjJ+Xvby+mRxX4lNQadH4Q++BS+dzNM55V3lAOTsl0 6rHBXjZD6vp45XO2ubxJ/wb6s93K8jtZ4izyA+t/ExjfuzYO+nrc8bZrruN4fpCdwyFo HQ8g== 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=9csNh8alUiTOu6v35oG9D0AnTmDVVsMsKU82ONlauSA=; b=D7Q0O63l/2ZDMPCr9MLB1wPwDeqZy3fwiC2EPMsbD5np5eOvgDaV9Q0fT2PD/AAi9N iHL1vWln4yZyfM9+jlpgnEKl6GKNvG1rlQlGcC4vMlud8kVG1qUYW17jToQNKQMnkOqf jFD84N0fSNiCoe3YCxRIIGMmu4WYtMYQLQwcqkd+aiDhBkDzKIDE5VVurQz/xvnGtVM4 hQTIDIc1+zqHgzTfge1dGoqcCv4aFtr4twIObGx4nJuVguqN9QqGzbM+T8g/rG5ygkG2 9S3d+GceSxTK87zcHUgZ5z67OOF63vlusLtPetx0NntBij+Y7N+bRKP8TkTI/SVios3b W8Mw== 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 t69-v6si3927627pgd.55.2018.06.14.00.15.19; Thu, 14 Jun 2018 00:15:33 -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 S1754768AbeFNHOp (ORCPT + 99 others); Thu, 14 Jun 2018 03:14:45 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:42791 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754605AbeFNHOk (ORCPT ); Thu, 14 Jun 2018 03:14:40 -0400 X-UUID: b517384dfd664930ac6ff0973f9fada8-20180614 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1895804412; Thu, 14 Jun 2018 15:14:35 +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; Thu, 14 Jun 2018 15:14:33 +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; Thu, 14 Jun 2018 15:14:33 +0800 From: To: , , , CC: , , , , , Sean Wang Subject: [PATCH v3 4/7] Bluetooth: Add new quirk for non-persistent setup settings Date: Thu, 14 Jun 2018 15:14:26 +0800 Message-ID: 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 1dec337..b917fa31 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