Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp267086lqt; Thu, 18 Apr 2024 14:44:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpr34YfLUzSy/Wx7CNC6m4X76X/dH8zpZYKF5gLVjuNy/YrMuV1eKIhCHsOlZ/zylctOHO4nSRsfJkbiMkar7/ZAUP7j41wa/aXRDy7g== X-Google-Smtp-Source: AGHT+IGsvuM0GYSa9iEwgOS11e1/uscjNaE1+JwptHH8vzm3ObHPnI8J8R/HOduDJkHbuJwF/WO7 X-Received: by 2002:a17:902:e807:b0:1de:fbc8:53af with SMTP id u7-20020a170902e80700b001defbc853afmr403928plg.25.1713476640100; Thu, 18 Apr 2024 14:44:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713476640; cv=pass; d=google.com; s=arc-20160816; b=oDU01oi8mgvM437LqolQlIS1QRSAS6BXb9UOt+xMRo6WrjGZlgnMsup/5/C/YFmjIa ReNhdXtAjQI6yKroUqIrizn9BPRzaHOWwiu4RrFfXkeX1hBt94TxZ3mm5+DDgc/0fuWr DXyKeb8yubilqnChHf98o/PBL0OawoV3t52SpsC3VgTnxTAuH9cXWWCzsOrE9vmyisbD sI7JEUR+BboF/Hz8azubfeLEWYnOi9T1v0VzVtqMoKGmybaNoX6ooBHQ1dd24nzXNS1G Oh5O7XIXevfIWrYxZzCcz2m6HimqEc/SyTWq+iPEYEejGUmUE3Hx4XPE5q+Zsv0Wr+cV NFWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=s+sd+GM8A1gkqW6SrlYO9H46f9pMSUoT1xNn0rWf4Cc=; fh=XB3BKRc9cHyGvJcuqN5jA+ztKNgI1BuDFzscajyYcs0=; b=hXVNMGMpPdirSI87p78ZQ7CcjkSuleMUoTv0Q3ujQEKMO4Kb0C7ijQfWNo/wLFbWAt vpcu3rBqMFguyosmwG2pZDwDwUYvMQJxEy6Vq4/u4bULbcW2zB3jubiF+AIPpa9YZffH xZIyHGCYtXFtq4bieBMs1/QDFpOqqn8gEqUV6QtxqaB3W4zlaP2sfFtsaJk43BsenZT+ jHC5vECmTBdLGHNrrDjBWKOgWiPAg5Q41U3/PUZWjG390Y82OrBiKDbkION/B27Nld56 JS8sSwrlc8876klH8jbUkiccbUTJ460FZWCJxS7t7ExnCvCDef3Vjq/Alypg5u7D4EOn CeHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=SmouDq9P; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m3-20020a170902bb8300b001e464fae16esi2002935pls.394.2024.04.18.14.43.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 14:44:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=SmouDq9P; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6847E285268 for ; Thu, 18 Apr 2024 21:43:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7AC2199EAB; Thu, 18 Apr 2024 21:43:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="SmouDq9P" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9C66199E98 for ; Thu, 18 Apr 2024 21:43:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713476625; cv=none; b=kRT4RTzQUOszZ/unA2OykcYPVlYxEopnLgN4Foccii7LRPRDMGhpND7GaBPtzbc30R68ECTYh9d5kJ/xBRzEOwx+QV2ZN7sdIRv2oLND80zVlSCwrXPA6Xio1pXnpQ2aHtpCtM5+jsaBmgI1auaXPzhMQT2a7jBMQyAEajuIOTw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713476625; c=relaxed/simple; bh=oNWEH2KnMPXtRWECODQivviaS1rxECZkI/FN3JGzvNM=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=ePe1aoWrX9hOy0fJ+7PySQZs2IpDmANQYnMJLGh9wdLbKQzHAJgV+KJn/yKWy63Jtawb7KI9suTFsUwPrqC+SblEH5zKC8ljPw3TWQa87dLPmDVoVNqIUMWwHb2bXv16Rh3Oub2cowW8qkxwMCsBGBzGnMV0O/4abpoYAh+4QMY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=SmouDq9P; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 43IL2AIh031436; Thu, 18 Apr 2024 21:43:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=s+sd+GM8A1gkqW6SrlYO9H46f9pMSUoT1xNn0rWf4Cc=; b=Sm ouDq9PCv/cptZBprJLGUzvok/tzKpvtm+DIXeEjSuqusr+NLJwmTmpLLng0yKAuS xzrsdR4XEzMj/8n0qwVkKzozbsfi/xETVsj3+ZitkEBXfa0fOnTudiz2eqowwefX og1Vg+07920hm657/uwwih0YfLhYL41IOL/oJWcoi5bOZ9g0kp6qYp033g50iBh9 JhLtjxuAch5oyFsiqG3MzNMgK7HwzpY0RP2OHWSbK7RXEB+uWxIQe43+RMY9ZXvl ntPGx39fpCHewWxhSSgbdy0tYVOXgKpW6tl06GN6ByIQpKi96jUTr/STWM86K64X ScWjjv0BMkcqlmYgOPdg== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xjx54j1at-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Apr 2024 21:43:36 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43ILha1c010320 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Apr 2024 21:43:36 GMT Received: from [10.253.9.141] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 18 Apr 2024 14:43:33 -0700 Message-ID: <1ab7e6fd-68f2-4952-b5d5-bc244b8b7eb3@quicinc.com> Date: Fri, 19 Apr 2024 05:43:31 +0800 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/2] Revert "Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()" To: Bartosz Golaszewski CC: , , , , , References: <1713449192-25926-1-git-send-email-quic_zijuhu@quicinc.com> <1713449192-25926-2-git-send-email-quic_zijuhu@quicinc.com> Content-Language: en-US From: quic_zijuhu In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: NDUD0ga-CeXlXt6tgyay41zNhOhpepDU X-Proofpoint-ORIG-GUID: NDUD0ga-CeXlXt6tgyay41zNhOhpepDU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-18_20,2024-04-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404180156 On 4/19/2024 1:00 AM, Bartosz Golaszewski wrote: > On Thu, 18 Apr 2024 at 16:06, Zijun Hu wrote: >> >> This reverts commit 56d074d26c5828773b00b2185dd7e1d08273b8e8. >> >> Commit 56d074d26c58 ("Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() >> with gpiod_get_optional()") will cause serious regression issue for >> several QCA controllers such as QCA_WCN6750,QCA_WCN6855,QCA_ROME, >> QCA_QCA6390 and QCA_QCA2066, the regression issue is that BT can't be >> enabled any more once BT is disabled if BT reset pin is not configured >> by DT or ACPI. >> >> if BT reset pin is not configured, devm_gpiod_get_optional() will return >> NULL, and we should NOT set quirk HCI_QUIRK_NON_PERSISTENT_SETUP, but the >> reverted commit SET the quirk since NULL is not a error case, and cause >> qca_setup() call failure triggered by the 2nd and later BT enable >> operations since there are no available BT reset pin to clear BT firmware >> downloaded by the 1st enable operation, fixed by reverting the commit. >> >> Fixes: 56d074d26c58 ("Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()") >> Reported-by: Wren Turkal >> Link: https://bugzilla.kernel.org/show_bug.cgi?id=218726 >> Link: https://lore.kernel.org/linux-bluetooth/ea20bb9b-6b60-47fc-ae42-5eed918ad7b4@quicinc.com/T/#m73d6a71d2f454bb03588c66f3ef7912274d37c6f >> Signed-off-by: Zijun Hu >> Tested-by: Wren Turkal >> --- >> drivers/bluetooth/hci_qca.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c >> index 92fa20f5ac7d..160175a23a49 100644 >> --- a/drivers/bluetooth/hci_qca.c >> +++ b/drivers/bluetooth/hci_qca.c >> @@ -2323,7 +2323,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) >> >> qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", >> GPIOD_OUT_LOW); >> - if (IS_ERR(qcadev->bt_en) && >> + if (IS_ERR_OR_NULL(qcadev->bt_en) && >> (data->soc_type == QCA_WCN6750 || >> data->soc_type == QCA_WCN6855)) { >> dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n"); >> @@ -2332,7 +2332,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) >> >> qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl", >> GPIOD_IN); >> - if (IS_ERR(qcadev->sw_ctrl) && >> + if (IS_ERR_OR_NULL(qcadev->sw_ctrl) && >> (data->soc_type == QCA_WCN6750 || >> data->soc_type == QCA_WCN6855 || >> data->soc_type == QCA_WCN7850)) >> @@ -2354,7 +2354,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) >> default: >> qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", >> GPIOD_OUT_LOW); >> - if (IS_ERR(qcadev->bt_en)) { >> + if (IS_ERR_OR_NULL(qcadev->bt_en)) { >> dev_warn(&serdev->dev, "failed to acquire enable gpio\n"); >> power_ctrl_enabled = false; >> } >> -- >> 2.7.4 >> > > I told you under your yesterday's submission that you should instead > consider bailing out from probe() if gpiod_get_optional() returns an > error as right now if it returns EPROBE_DEFER (enable-gpios is there > but the controller is not up yet), you will act like the GPIO was not > even specified. > > gpiod_get_optional() returns NULL if the GPIO property is not there or > an error if anything else goes wrong. In the latter case, you should > abort probe. > 1) do you meet the case that EPROBE_DEFER is returned ? 2) does the reverted change solve above issue you mentioned? 3) does the reverted change solve any functionality issue you actually meet ? 4) BT still is able to work fine by clearing the quirk even if getting preferred H/W reset way failure, why do we need to bail-out and return dev_err_probe() ? we will fix it by right way if EPROBE_DEFER is reported. this change is to solve the issue mentioned by commit message regardless other issues. it is not possible for every commit to fix any other potential issues as long as the fix doesn't introduce new issue. right ? > Bart