Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4257459rwb; Fri, 30 Sep 2022 15:43:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5r5NfPmKDXcs7Kssq4upU9SkBIW5ViKq/vQvDEruiGacTKCLezm6Rdv9hg0OezHmGkozsP X-Received: by 2002:a17:907:ea6:b0:782:1ace:9d5b with SMTP id ho38-20020a1709070ea600b007821ace9d5bmr7555702ejc.770.1664577792383; Fri, 30 Sep 2022 15:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664577792; cv=none; d=google.com; s=arc-20160816; b=D0DESfsmAlfh8uI6Pagvoo6Zz30mBgLoyS/X0KdZ2c4GaSSA/qRHsfVGNB1ae4woUs QhpzXCY9rv2weZQrqwzVWJ4FsNzfwPL5jmJmYXgaV1+gMFMKorz3G158SUmO49UA38ep v29kDRd5y6x3USvMxuygJ6tDl5SIdA7N3BJMatLjiyaYiE/qHL6Umsh70IZ+3qN1As5I zbVCrfnmmXFqS58o43nDWtzCm4TDAmW7TQxYYAhEgh7WaWxQ5aX04CsuaxwIoA/aQI35 Uu9LwleiyiY0a8Sclo8iq9QsSc84Mg50WeSNhfKcHxaLyNqsnAA/7QzskTSpGAPmjyGO vKXA== 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=ynUUF776hvbTO7RaoR/PaAJJm6BIrzM9Le2Vv0E+owo=; b=kuczjSUTM7V7z2byrtDUf1p3Jc/HB0UpRKr4DRQsEnrGuzrvWPEu0N/G9Lz4yiA+dT xiMceX9Mta5mLt/RTvc488bR1U+QsjuMIZ+pisSQkXslQobF16yhtzompe1zFElWX7mx MYdK+9Na84S0X3RHKhwvSxmO2O6B04GIimJ/obA/xJG+M30VBrvVB05j/m2XTZGnfOsK Wc2FLar91/T/ZXnDc8F4UF6P80MRUotLZSFfFcHWWHaoVtPIm8OIOqiUHMaRV0aAcPyr ozUNgUM1xUvDwTya1nq2d+55NaTxguQGKZS66/MVgio0jVp4T6bkXX8/ZTsDtAw7Yu59 bLjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VRKpP10L; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn25-20020a05640222f900b00457053aadeasi2651058edb.398.2022.09.30.15.41.36; Fri, 30 Sep 2022 15:43:12 -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=@google.com header.s=20210112 header.b=VRKpP10L; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbiI3Wav (ORCPT + 99 others); Fri, 30 Sep 2022 18:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbiI3Wau (ORCPT ); Fri, 30 Sep 2022 18:30:50 -0400 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91698156545 for ; Fri, 30 Sep 2022 15:30:48 -0700 (PDT) Received: by mail-yb1-xb2a.google.com with SMTP id 207so3599277ybn.1 for ; Fri, 30 Sep 2022 15:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=ynUUF776hvbTO7RaoR/PaAJJm6BIrzM9Le2Vv0E+owo=; b=VRKpP10LYR+ulT2MMmZNp9z9QFZ5zqHDABMmKOAbEaDhVYzpdo2rRFYQKfgrKpv0qO kFMPddyexV0AhcDzULVCn5SK8LK9pCgs3gWiPrTWEmKqdUkmWSgq/jdN5IexsRRPlmMw UB+XujaXDw68TCNilYW1KYrbesSMKeQptMuP6Xl11dAgPXrtAOGiyL/hwU3psj4LoPhb +nbxZx1XR/6k0ldnlUhNggmdYNDT7Xq/BUoc+duKpSztfBx9Tx7nX/x880vLQW2yIudQ +FIFRPsYkSMgOWhk/Iy48ABYyCzAf50DMrlrmfWn1DjpXzk8ht84Iwz3Fq1RCgfViZdf LoOA== 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=ynUUF776hvbTO7RaoR/PaAJJm6BIrzM9Le2Vv0E+owo=; b=kLiSZI8qj+G+7rqBMfac0GuVwwAb6EIhveiN6qOUR6G3kNndWGuW9EXl82epsEbMxx Juz8ULoVOQZS61CUzrCKS6zghzvZ55QtRxlEhBxq8+0bQsaOc1LZLOhc24P1QYAA7MS3 wNqfYspyMu0gUzfQibAlFkiNGYbQqR0+yXWA2eqL9bgFB0SlC7rm0W+i4KwXzq8CgrfO Bs1PIbaNC8Ktpq1yWaEWlAqAK4gUbIRk3Cq1NcbS9WXTwclTGY0SHZ6QZv/hpj6zYi/+ nM2WTPRZ8x7bMW7vqJrKMZgu3YprOyZV6ud948LvFKcDN1zxUBk8XNOR62NONtqS/Dj3 4WWw== X-Gm-Message-State: ACrzQf3rqqM715IemyRiBv+QV9qqmZ+W6GCEGPFipGf6CCTmKkqvNvWo WcYid5q3KxYv684M+mtbXp/weT9W1ObAJhLMe3EJfw== X-Received: by 2002:a05:6902:1002:b0:6bc:829c:8ce7 with SMTP id w2-20020a056902100200b006bc829c8ce7mr10925386ybt.453.1664577047399; Fri, 30 Sep 2022 15:30:47 -0700 (PDT) MIME-Version: 1.0 References: <20220930140655.2723164-1-ajye_huang@compal.corp-partner.google.com> In-Reply-To: From: Ajye Huang Date: Sat, 1 Oct 2022 06:30:38 +0800 Message-ID: Subject: Re: [PATCH v1] bluetooth: Fix the bluetooth icon status after running hciconfig hci0 up To: Luiz Augusto von Dentz 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.0 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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 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 */