Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1236099imm; Tue, 22 May 2018 00:21:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo1KG2zxZ2MhscFugnmh9v4uP/GaozJpz6sGKRAUAplprRfDCQIhe9eU230BRmaLQxV6uUS X-Received: by 2002:a17:902:1a6:: with SMTP id b35-v6mr23507488plb.80.1526973710206; Tue, 22 May 2018 00:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526973710; cv=none; d=google.com; s=arc-20160816; b=uW4fd88ofI3N8L+lqEStlothPnYRaezgUrTOXh/NV3CM8pL0oQc+w745GwWiMEs4I1 ojjjHiAm5/MwtUvfNXsQyYljeAlyUhMG/cFWvIatEEQ5SwWLNty7hjntJjIQJUfa5nNF kLNmeEZoc2jsag+NAo29Qz42xfMXvxDvCdhJ7VlL4LzrD+so1lXEogsbkBYA26Djc3xB Q+7FSsK6cYJP2gSXQi4rVjaE/zMN5JhHnrebM2rdn+Crrl+Bri55ITSAksPjTX0IMAmd Bl/rjoTgLElqpXzyXpDNB5JuzbnGOMfVK9FVC/MXvBarWbwUPi4UtKT5m7uTwVyhtDBm pzzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:arc-authentication-results; bh=iup4nrsfXGyLljABRJOWHM+I5zXDemlRw+QqObDjOqc=; b=XY+GnkPBSPo7sMFuAELNmvpLIYaeN6IXgnRgjdSlriem8ZFSbKpZ3lzdwrf1l+7Oq4 sZui4QMzk5bZtiwxpH5Sbh20t5dYnOL4jIn1Y/WE7cLLimdly6kku21chGDCiaINBA3r p11fNFfjSVWy0aWg00va8v4vlPS1paVtzM19sm/rFl69oPCwoItKMgzsYg86zOOIOXmH nHytymCrUbbNkBhzC3FRe+s0uqCSGFV5ozcGSZ3llIcKdRtUjgfaSKrzPdVGUNWKt7Pz 9XB91MrqIEzof9pBtk/JqvhJ0p8bZf/mizN6Lhfv7kAVchnuUykZJk4ol8/YOipJhrHy 9cxA== 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 v11-v6si9710919pgt.114.2018.05.22.00.21.35; Tue, 22 May 2018 00:21:50 -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 S1751257AbeEVHV2 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 22 May 2018 03:21:28 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:56344 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753AbeEVHV0 (ORCPT ); Tue, 22 May 2018 03:21:26 -0400 Received: from marcel-macpro.fritz.box (p5B3D2CDF.dip0.t-ipconnect.de [91.61.44.223]) by mail.holtmann.org (Postfix) with ESMTPSA id D7170CF182; Tue, 22 May 2018 09:27:58 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH v2 4/7] Bluetooth: Add new quirk for non-persistent setup settings From: Marcel Holtmann In-Reply-To: <1d6097f538b3182b2876ad48225ecd6e2d1b128c.1526374087.git.sean.wang@mediatek.com> Date: Tue, 22 May 2018 09:21:23 +0200 Cc: Rob Herring , Mark Rutland , Johan Hedberg , devicetree , BlueZ development , linux-arm-kernel , linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <920B3BE9-3FE8-4AC6-8C5F-63B0E00182AC@holtmann.org> References: <1d6097f538b3182b2876ad48225ecd6e2d1b128c.1526374087.git.sean.wang@mediatek.com> To: sean.wang@mediatek.com X-Mailer: Apple Mail (2.3445.6.18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sean, > 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); I am not 100% sure that we want to send the HCI_DEV_SETUP event also multiple times. That is a userspace change that I would need to think about. We need to check create_monitor_event() and see what the btmon trace for this looks like. Can you send me a btmon -w trace.log when this change is active. Regards Marcel