Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2468567imm; Thu, 19 Jul 2018 22:13:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfe7+kgyL/H64b/sthsF/684j3n0JZEz7lCnVp3FI0HwR/q+Hl/lXYqZqLjEdU8+JocGFIP X-Received: by 2002:a63:d518:: with SMTP id c24-v6mr613699pgg.357.1532063616504; Thu, 19 Jul 2018 22:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532063616; cv=none; d=google.com; s=arc-20160816; b=Dykr5bOYPp9U/M0quLNb4y2kZYxNORKSRrRSIWFuW9tXeH11HFv7cTXIFZfUIt+/3G c0REUz4fH1p5DeVlFDNU9eYhuJUJpDQvvG8IVfzyRYnHKoRfKIT6E+scnXTG89WCftrr RC6joBQkKmUI5skzc4UAulh0HuJK5tN5ZgEe2y9W9YthFs1ynI7EpFZayqKQd7iDQhVp JKE4l61Sx3jYgafSuWSHTJK1CCW1lSEdpD2F/0f+lGqTtQ8PXWqBAZMfxmipu/ydUvXm v0jFAaAYYIbpERkOHZhKFV/QOFsaEwRVRb/eIkeRaol1ybXl5ERR+FboyOVmrjGp8dy/ LUZg== 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=dtJyIHHvlBPB8mQSnmetGXFc657uG4lNUSOUJauwskGgX3xzACiwvsbSuRmz6+3Eyk uQ6CHMvNMM7OJiqaXFxmpCSwOD0w0alD/asIV9J2kDxWknW9JBCcpo9jfYEmxvWxtEGE nMKqnY7zxvmOwPT/KiYlK2GikdvVS4cYXdoZ3DykK+8PFY0jcleTroER9prF8NXNKAVv ggCV1r9BjHehxO6PxhHCuMShCpGAYXwbISKEdZ56o3lNVTq/NksXRLSahYbAnG+77M1F h8oSkDkTwVY664no7ltcuWkF8B4yIRpCvpv+D9FfA8g7gLTJ3BRCJoc++/dwrsmtx/yP fGHw== 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 h3-v6si956816plk.47.2018.07.19.22.13.20; Thu, 19 Jul 2018 22:13:36 -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 S1727718AbeGTF7I (ORCPT + 99 others); Fri, 20 Jul 2018 01:59:08 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:9175 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727177AbeGTF7H (ORCPT ); Fri, 20 Jul 2018 01:59:07 -0400 X-UUID: 1f676073f95a45d4b0f4c0688c1f2081-20180720 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1411473296; Fri, 20 Jul 2018 13:12: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; Fri, 20 Jul 2018 13:12: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; Fri, 20 Jul 2018 13:12:33 +0800 From: To: , , , CC: , , , , , Sean Wang Subject: [PATCH v6 2/4] Bluetooth: Add new quirk for non-persistent setup settings Date: Fri, 20 Jul 2018 13:12:28 +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 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