Received: by 2002:a05:6504:5087:b0:1e5:d399:13c4 with SMTP id i7csp1967764ltq; Fri, 30 Sep 2022 16:08:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6h2h0o56WVlHEpAuRBNDRyABuqMVQvm623C3bgOvmOrcyNgly441l2d2dpfHvCOcpK5Gdr X-Received: by 2002:a05:6402:5189:b0:451:791e:f328 with SMTP id q9-20020a056402518900b00451791ef328mr9435049edd.282.1664579317226; Fri, 30 Sep 2022 16:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664579317; cv=none; d=google.com; s=arc-20160816; b=eW7IRaN6BOQTdyPNi0hs5hC9ArEHcjHxEoQ7BY8L4YY19d0HYdLau1LxmmXtQImd3K 3W0qWw6XijW+YVMVnWHEci10jmmx2Esdx3//zgXqgrWUa+DO8GLEsdFDpw3jWCbVOF1R OqOG2J6jF2gxrunMMxmB05Ryb9+/yUTbjTklN1C4PRPIssD2d/+hCGPBScChPqq1lTJz y174y1Ipto2TWfbrjjLH+zjGfAG3wbAfsOkUqnEb0k/MIK6OvA0b/qUp5ElSutaNORJA U2K14HuICbIPNtFf0RTfSj2HcZA9/LrL9sUnwPMVIdSzadG2OilFmudwmP26i6n4+1Z4 w0rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FPDhyg+fqnd6KI676BphOSnDk1rwd88+iFcjWjngdEk=; b=ax401GuCmE/EGTIfPrlvXNlYp5otq9pAtJaQcF9lH6AhakORGZyNW9atC1f7Hib0mt uRPtPdKr0V8aAZ5gfZhTXcHO+m5CKRokFaKq2IFiMJIxf/81z/FdZpI9xR2Mp+66B00C zzxrc1PQNonTM2fnO/DiB/INK8ze6alNjXPHR7DCvTm2BdM8twyOkK+IrfYZGp0M43QS 3WR4d4DvWRaHGr0w6GcI+RhiuNOZiUGsEOGvLfLVtg/tsdav5LUsUaJwieMsuuN5JUu0 EVs7xizxcJSBpdeYOHHQQoK3AXsSAfKUhi8hmBe6m6SPNuXW0JRKnDCr4ITr0+kHGySx HgxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T+cBzOQM; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a50eb07000000b004532dbfc916si2712098edp.615.2022.09.30.16.07.12; Fri, 30 Sep 2022 16:08:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T+cBzOQM; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230425AbiI3W6p (ORCPT + 99 others); Fri, 30 Sep 2022 18:58:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbiI3W6o (ORCPT ); Fri, 30 Sep 2022 18:58:44 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 096BE1166F3; Fri, 30 Sep 2022 15:58:43 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id z4so8976168lft.2; Fri, 30 Sep 2022 15:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=FPDhyg+fqnd6KI676BphOSnDk1rwd88+iFcjWjngdEk=; b=T+cBzOQMyhh+6jhfOrIUDL6wQFttyucRRtPWsMeZoMN1ydBnJoRcQh5hqbY34Bx3kO ziDWgtrclU3pbCStFb9zWTcpSTljj9imf5FbudgxPedyaZXFruiEC3PhFm+/lcbKavhj 7ymDdwIrmL4sUHS4tZEPi6n8EXgNGhJlwbpm444R+mEnAFBvRtkk/gJDZ7HaZFEH8uxt JJ7JUIQPYL/iUG4BDETwX8qjK6OiLBZTqIxd9Xl7NmpqWMhjh8SQ6BdqsI5BDVP/4dZQ ZAyy22UmDFBiTqk++TgKykS7xaBjuGYluQ6OOPDtUdwGl/L/YC6QdfU7tTJ8Q2r252Yh Svyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=FPDhyg+fqnd6KI676BphOSnDk1rwd88+iFcjWjngdEk=; b=48pl/mmMC7ETThEQrFFgHJdtsZvXu+YCNgH5dHh/Dh0O9dlHy05ZZ0itgOCLCg0YNl L9jhp0zz918G2KQ0JQO9XbVkDP+EBIC0vXcBIOd39zg7qMN5395mVhOzovRmsyBO46tU RdjhUWOuz2ikqlUcd3aFvibPz9bTfrbejI0dji2SDfySFlnW9FbkgEy+LRwxUXllTMi0 GzjGB8S0ZJ7ArVkIuQWpAvodt9G/oYjTUg/kITTZHXl7DdFfPzxbx9cW5pd/ib4zOPBT UWlr9o1wAZ9mesyozTHBlmCzDjLLma+GcOitDEpT7rbttBmPLTQVvhreha2OUkynyk0d iSOA== X-Gm-Message-State: ACrzQf3vDOcwSb5iitfv+4lH7krwCZGy1cw1p6TwqAY13JYeM1d3JX2N pcgi8MsIaqUi021ihU9Bovw5NL3mpiE3AFa/X3g= X-Received: by 2002:ac2:4c8b:0:b0:4a2:2432:93ff with SMTP id d11-20020ac24c8b000000b004a2243293ffmr128870lfl.26.1664578721152; Fri, 30 Sep 2022 15:58:41 -0700 (PDT) MIME-Version: 1.0 References: <20220930140655.2723164-1-ajye_huang@compal.corp-partner.google.com> In-Reply-To: From: Luiz Augusto von Dentz Date: Fri, 30 Sep 2022 15:58:29 -0700 Message-ID: Subject: Re: [PATCH v1] bluetooth: Fix the bluetooth icon status after running hciconfig hci0 up To: Ajye Huang Cc: linux-kernel@vger.kernel.org, Marcel Holtmann , Johan Hedberg , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Ajye, On Fri, Sep 30, 2022 at 3:30 PM Ajye Huang wrote: > > On Sat, Oct 1, 2022 at 3:57 AM Luiz Augusto von Dentz > wrote: > > > > Hi Ajye, > > > > On Fri, Sep 30, 2022 at 7:07 AM Ajye Huang > > wrote: > > > > > > When "hciconfig hci0 up" command is used to bluetooth ON, but > > > the bluetooth UI icon in settings still not be turned ON. > > > > > > Refer to commit 2ff13894cfb8 ("Bluetooth: Perform HCI update for power on synchronously") > > > Add back mgmt_power_on(hdev, ret) into function hci_dev_do_open(struct hci_dev *hdev) > > > in hci_core.c > > > > > > Signed-off-by: Ajye Huang > > > --- > > > net/bluetooth/hci_core.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c > > > index 0540555b3704..5061845c8fc2 100644 > > > --- a/net/bluetooth/hci_core.c > > > +++ b/net/bluetooth/hci_core.c > > > @@ -481,6 +481,7 @@ static int hci_dev_do_open(struct hci_dev *hdev) > > > hci_req_sync_lock(hdev); > > > > > > ret = hci_dev_open_sync(hdev); > > > + mgmt_power_on(hdev, ret); > > > > > > hci_req_sync_unlock(hdev); > > > return ret; > > > -- > > > 2.25.1 > > > > > > I believe the culprit is actually the following change: > > > > git show cf75ad8b41d2a: > > > > @@ -1489,8 +1488,7 @@ static int hci_dev_do_open(struct hci_dev *hdev) > > !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && > > hci_dev_test_flag(hdev, HCI_MGMT) && > > hdev->dev_type == HCI_PRIMARY) { > > - ret = __hci_req_hci_power_on(hdev); > > - mgmt_power_on(hdev, ret); > > + ret = hci_powered_update_sync(hdev); > > > > So we should probably restore mgmt_power_on above. > > > > -- > > Luiz Augusto von Dentz > > Hi Luiz > > Now, this code you mentioned in hci_dev_open_sync() was moved from > hci_core.c to hci_sync.c > The below modification is workable. > Do you agree? > If so, I will send you the v2 version. Thanks > > index 15c75ef4c271..76c3107c9f91 100644 > --- a/net/bluetooth/hci_sync.c > +++ b/net/bluetooth/hci_sync.c > @@ -4676,6 +4676,7 @@ int hci_dev_open_sync(struct hci_dev *hdev) > hci_dev_test_flag(hdev, HCI_MGMT) && > hdev->dev_type == HCI_PRIMARY) { > ret = hci_powered_update_sync(hdev); > + mgmt_power_on(hdev, ret); > } > } else { > /* Init failed, cleanup */ Ive submitted a change like that already: https://patchwork.kernel.org/project/bluetooth/patch/20220930201920.225767-1-luiz.dentz@gmail.com/ -- Luiz Augusto von Dentz