Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp196767lqd; Tue, 23 Apr 2024 21:55:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzqMDUJRmHUIz1TVvHNnBqAiRd3xE2HQAhOBiASrw4MfNE3cPx9dQaz08hBO4x2ttPCArl+jfUsFAXtqzg2u/vSehVQyQsTIKftnUKhg== X-Google-Smtp-Source: AGHT+IGP8mEqoLl4Gxm+unNL58Z9O1ACV3ADfQrm+AywEyzNfCmfhHfnf0GP6oseWxE5nlcpdFqE X-Received: by 2002:a05:620a:f0f:b0:78b:e305:8344 with SMTP id v15-20020a05620a0f0f00b0078be3058344mr1637064qkl.46.1713934556119; Tue, 23 Apr 2024 21:55:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713934556; cv=pass; d=google.com; s=arc-20160816; b=Z93p07OVxPYvQ34Ltj6o9wn+E2yRHBm3xN4Vtb0V+RtItiYENeHfOF9cwrZ9vwfLlJ PupWTEOnp9xYf8fLtbY0dtjnIKI2wryO+W4nUMm6IESHEWXFwaoK+VNIsB/C80vt2GMw qpQkQ1gYHhdrP5zJOz8kEAhu0ZdDsbSFeLohnk4Zw9w/AE6pXHRDARCifOcBuf0KgDbE TQatC7Uo3H1PMIUU48/t0GYRBFXkMRbubEAMhouj6Rd/LHUCxFN3yJDxvfVKo49RDY1N zs1KknjxMgO6wJctnaJn8BLDHHz8idp04y3x87VEb5tLatQdTMtb9dLr+AJPLNfndbKI Lccw== 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=d6RfTbleXipL1qn6KV8zRM3DFf84k4bMIcll6M1FFlg=; fh=v8tFgtrEkqTcbkk4+t9tPl+5/vwHxFk0Ql755+RD+RI=; b=UHmYG0knR3dtCrwx8k3i7TewgTJaDTLp+HWihHcsGM91cTGmuYLLLtMUDOIN/d4M0S XxE+bi5gJ9y1/4pix5Ct31APj1zUx3GE/pmSI5tCtyazluMeZXiyMi7W9g79fiE0a4pU blw94PMLvpzG9p+LCqQ4+Hd8zEpc8rNI7XrFbHj3XHVXiMd4j4K0Go4WXxVd/ibZuRX+ UhvANvMGg0ujf1xLsA8rUHDmD7qQtQPbufP99nCkYPA9y7sufZoJSSjnLSmACSXZQgye yP0LgsuIno6O/LWaSal2O7JWrSfnuAKnQTJGsgMe+eYhFoEZm1dzMd/NHA5YSIySyx0B AM+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=S6sjMxfK; 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-3935-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3935-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e12-20020a05620a208c00b0078a36e7bd63si14420880qka.491.2024.04.23.21.55.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 21:55:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-3935-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=S6sjMxfK; 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-3935-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3935-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D59FB1C22067 for ; Wed, 24 Apr 2024 04:55:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D5590154437; Wed, 24 Apr 2024 04:55:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="S6sjMxfK" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 DA4CE13C82F; Wed, 24 Apr 2024 04:55:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713934549; cv=none; b=pu10oJXrzMw+j8jRcsT5/0WmMLAKQSgT5O1gGFjV/9mdWeKqQtcFdXObTtHUfgmKPYIYPq32CqiMrnnjvd0nUxs4HfcA+dreefe0bFmGpowauw+maKC+oa/p7Ipr59cy//dSXzgXSn27M/p+g5uutfo2cnrZyy4bb+hgxcqx4is= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713934549; c=relaxed/simple; bh=3HNfuRsq5bP8CtlU4c34os9Pd3q+GbzNbJqEXXr5x1o=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=WTYWtJwNpCSt1j+qRMO5B+WnYWrw4pjIHy3Yf961GB4Zu11MvuN0YwMxUope9PVm49Lzq+8V5imwz04udRxsQ6JPapFfNjWL2vj2r7Ed7uEpeaJFWDpSabiH980qI8hQHIxGMjU+9/iKlf0CgZy3FjdfaTqJXviYD3Q/gTQgLmk= 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=S6sjMxfK; arc=none smtp.client-ip=205.220.180.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 (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43O4YpaL009997; Wed, 24 Apr 2024 04:55:43 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=d6RfTbleXipL1qn6KV8zRM3DFf84k4bMIcll6M1FFlg=; b=S6 sjMxfKoVyTRCUtb/opByWZ/jpzdNz7UTxVOUXXFz4LI9XjntL7pS/8CXHQ8FE0MG to+l0tsrEiJronR2J2GPJPzBI2xLhz1jZThvCzbrHQYEhyqqzsK300ordUJiVa73 IJLpT+PUClGTGi4oZIKYwFSXKdPnVi1fqBYvJt9ltCRWqGXkgWCbCRFXPuHE5HOW c248AjQj3pOEk59RJqctuOjWVrueD2uyN3NdgCWVJFwxsdvOS+A5nHfsjcBQajsw pvUlsKmCS6EMe6v/J5XGYyhZ2D6T8tNVdlFnX1wSVQi8K9GJvoJNQhzckCMxGtsB TtUWovkCfCB/+ac5Xchw== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xpu6a00yp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 04:55:42 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43O4tfAH008444 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 04:55:42 GMT Received: from [10.253.72.119] (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; Tue, 23 Apr 2024 21:55:40 -0700 Message-ID: Date: Wed, 24 Apr 2024 12:55:37 +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] Bluetooth: qca: set power_ctrl_enabled on NULL returned by gpiod_get_optional() To: Bartosz Golaszewski , Marcel Holtmann , Luiz Augusto von Dentz , Krzysztof Kozlowski CC: , , Bartosz Golaszewski , Wren Turkal , Greg KH References: <20240422130036.31856-1-brgl@bgdev.pl> Content-Language: en-US From: quic_zijuhu In-Reply-To: <20240422130036.31856-1-brgl@bgdev.pl> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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-ORIG-GUID: 24XnXVLNxtl46AyVO20Y4CMnI-rDQNGL X-Proofpoint-GUID: 24XnXVLNxtl46AyVO20Y4CMnI-rDQNGL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-24_02,2024-04-23_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 mlxscore=0 impostorscore=0 suspectscore=0 phishscore=0 clxscore=1011 spamscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404240020 On 4/22/2024 9:00 PM, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Any return value from gpiod_get_optional() other than a pointer to a > GPIO descriptor or a NULL-pointer is an error and the driver should > abort probing. That being said: commit 56d074d26c58 ("Bluetooth: hci_qca: > don't use IS_ERR_OR_NULL() with gpiod_get_optional()") no longer sets > power_ctrl_enabled on NULL-pointer returned by > devm_gpiod_get_optional(). Restore this behavior but bail-out on errors. > > Reported-by: Wren Turkal > Reported-by: Zijun Hu > Closes: https://lore.kernel.org/linux-bluetooth/1713449192-25926-2-git-send-email-quic_zijuhu@quicinc.com/ > Fixes: 56d074d26c58 ("Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()") > Signed-off-by: Bartosz Golaszewski > --- > drivers/bluetooth/hci_qca.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c > index 92fa20f5ac7d..739248c6d6b9 100644 > --- a/drivers/bluetooth/hci_qca.c > +++ b/drivers/bluetooth/hci_qca.c > @@ -2327,9 +2327,12 @@ static int qca_serdev_probe(struct serdev_device *serdev) > (data->soc_type == QCA_WCN6750 || > data->soc_type == QCA_WCN6855)) { > dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n"); > - power_ctrl_enabled = false; > + return PTR_ERR(qcadev->bt_en); > } > For QCA6390, control logic do not reach here, so it has no any help for QCA6390. > + if (!qcadev->bt_en) > + power_ctrl_enabled = false; > + property enable-gpios are obviously marked as required for WCN6750 and WCN6855 by dts binding spec as shown by below link: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/tree/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml if user don't config the property then "qcadev->bt_en is NULL", can we still treat this case as good case? that is why i changed my fix from reverting the wrong commit to only focusing on QCA6390. i will give different fix for other impacted QCA controllers. > qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl", > GPIOD_IN); > if (IS_ERR(qcadev->sw_ctrl) && NAK as explained above.