Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp508027lqd; Wed, 24 Apr 2024 08:44:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWR9XeK+Vvvrv/YtTq+ulWWfBDi6J0k+14lR17H8k3lN2KJ7JgAkQ+1qZB8008SIShH6U8l80ShiwZwWmZO+xcz2DN4w1UXhwfmah5byw== X-Google-Smtp-Source: AGHT+IF8ndGstTKwKcWb8cO3RPAFU+w80RfjCJ9JPt61kBeNX0M2uzT2vwSvwF2veYyIXXamFSFv X-Received: by 2002:a05:620a:430e:b0:790:9461:1b7 with SMTP id u14-20020a05620a430e00b00790946101b7mr906428qko.14.1713973463074; Wed, 24 Apr 2024 08:44:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713973463; cv=pass; d=google.com; s=arc-20160816; b=aTa6Ezq/8qhZ7SkMX1Ta3X0VwKCBIojtZcZszt3afVCGjsBo7ewRv1/O6m7Gvct+A0 KApWrEAIVrnuMcvQvzPb/zlBURfIfdsRc54giL1aQhXgCtRv1R3xuf5ferSPP2Lcbf53 sQqfX6MYhrd6EYEtOtkRoYeLeg5y3sUajrERp7jXjfH9AiI21fXJNvAslBTfvJg/mxmV HsYnmYb/cHA6rNzjUoSkmDPAUYeaFnl0DzoDbXOQ1coBXKP62K2U9+kvAJ5EZ3Q/p97e IU+yA5Kfq8aHHndZn3pOisdQixs8x3+KHTUoKW9jzmfV98Zj+KLTEYz9xwXwG3aVS8Y+ l3zQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=irGVQcAEFbUn9GBhtEboC87nWk4XwwJpeZ6vgx4r4Tk=; fh=nPUiZ5EjMifVmoXOCXDF/7UOSup3YPoXIIB2OtzyCeg=; b=qEb3NTVaDD1gkKqTHJ7dT1xxFATgZObatF1PSA8uJCWiwoJNYxzrsvepeYYg/e6YeF ipl603j0mpear+x6clYyMonOdrYrPRKSGnA0Vo6a4oMQ0qb9VVF8liYE9Jmuy8zpsTtS 6dVClJkxKfb2Re/QQRhsfa7sGGDPKEDmH+CeJ+Ye41Mr6eNkJgdyPKHOoD4Or57UdXyS qqLjIVohQDwSw5bXfAn2rdMIoITPlkXIQZL3eh/Mh30+l7uLWsTbNz19Zh1ySZdHzbMr wIJyL5xJ7Ybwhl3XJRORwIHOSgDRw9xEupeMfsNwnL5FxgDkquRPJTLsI+ualkw1ZVMV Tylw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FQcJh1Mp; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4036-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4036-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c20-20020a05620a165400b0078ecb2bc0bbsi15212244qko.113.2024.04.24.08.44.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 08:44:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4036-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FQcJh1Mp; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4036-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4036-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 B23F21C242B3 for ; Wed, 24 Apr 2024 15:44:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 678F916C860; Wed, 24 Apr 2024 15:42:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FQcJh1Mp" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33F0316ABC7; Wed, 24 Apr 2024 15:41:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713973319; cv=none; b=CybufDDkTqSwgMTAxBSddQCQmoPiXgxq3u/mWVRccRrkEDAnTM7mUhz2JemecNoQDypS0mXnPzgRPfI9Wd2CTtYEONqMw6YYvMhKoRYYT3M4itjZ5MjXdQX1+2yIFUX6fYNoWGxZgRIaAl+qIxjNejswWp7oWaa/1O3ByWqeWpY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713973319; c=relaxed/simple; bh=t93zKHSPtsBnQSWADg6nKxHiZzT/Xq3KTswC0usIJ2U=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XC0rQv9V4sxLf+L1VggkdwnMk8ciCb7ODJXTTpKg/h2FMzacPYdrHiddOGxD4RUt4puHCf+3qGGLNbIJrKN67RcwzR29/mk39Xbe09OocnZxGHMsaUagw5xElObLUxtS86E1CTHEkdbGr0D+wgcCEltv5MSIvDnCIRd9PFajwUY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FQcJh1Mp; arc=none smtp.client-ip=209.85.208.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2d87660d5c9so74990851fa.2; Wed, 24 Apr 2024 08:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713973316; x=1714578116; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=irGVQcAEFbUn9GBhtEboC87nWk4XwwJpeZ6vgx4r4Tk=; b=FQcJh1MpuGF4aiw0MSBi9uTwDB7+h2x6KbmSY+WZ4xjQt2d9oT8lyJ/XR2rGTp3tfC 3iVBzmagO+MwuTz3h2CFjvlsGHw55+QFE1TpI0mfHEk1Ubyys4L+wUjFyhWAFzdiuZxZ Zc3+3Z5L813Oeg/ixlPYNSj/F0c3EDwgGHa4rSbWX1/bW8NsJMZvBy5/H6zVxZRmCBuJ lE00NpVaLdptg1lLHfb1je0qdl+2YlccwaN2kG4QkWNr6rECOVxreoQI0UM9ihj8bh0I fzH/Hc0S9KJLVTV+cEtgaeBOWhbzp82k41q2usN9GiByi9HWablj/E1o1yWNNg1TEEnH 8vww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713973316; x=1714578116; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=irGVQcAEFbUn9GBhtEboC87nWk4XwwJpeZ6vgx4r4Tk=; b=W5j4NPVRxvBu5RZAExyi2aJFLTqqB7L+2VXY5C5Nx9MX0hdgDGQIXLCcBKfrMTw/1A 54GBOJxXriCRKbCzcUxLNOViM3OszXTmTV8jrHKU3PixipoPKRWTOg2CQf0bRq6Y5v9t bG18KlmtW5Vfu7x7u8+fUtMdCyo2C9VZlIWHsUJDLs5YtV3mAcrFW34NJJPMzcIc4NW5 TIu60yACz24Ghmex1ysGRBEIgIpvVXHEdWs0HXyUW3EpjhjJBrhBJi+eXwQFj+2Y56sr seS3xdTGqxOi6sHVys5G2MlYL9mCGcdR6c7l/JlZ/GpSXAvHNiZeaJ+qJiYMw2oscZtT ntCA== X-Forwarded-Encrypted: i=1; AJvYcCUphAg9PPe3mciziDWQPCwjMLWUn1yyiaIPNamoMGlh44yi3jig33t3yxvFhfinMSAof9CTxfA7E0VPHYZwm7ywGCNNQ2zeJDldPlqynscKQUmhuc0lzt2e5gca8oapXvI/2sNyajDbW0YAhgtJ X-Gm-Message-State: AOJu0Yz6IAVv5Nx+0XwFnBr8dFLQUsngxiGAchqV0IpsRrDQJqWVCQba esmfRadF8VyIXkUT6PtiynL50d+++5D6El1aS9WavKIwon/i0mfvYKS7jH8dgOcmZDb5GnWO88a tSejvSqPe2noFE0leqjQHrnCEC3I= X-Received: by 2002:a2e:9207:0:b0:2d8:5b4e:bddb with SMTP id k7-20020a2e9207000000b002d85b4ebddbmr2343776ljg.52.1713973315971; Wed, 24 Apr 2024 08:41:55 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240424122932.79120-1-brgl@bgdev.pl> <0f8ba1b5-490e-4961-80e2-7942f66730ec@linaro.org> In-Reply-To: From: Luiz Augusto von Dentz Date: Wed, 24 Apr 2024 11:41:42 -0400 Message-ID: Subject: Re: [PATCH v2] Bluetooth: qca: set power_ctrl_enabled on NULL returned by gpiod_get_optional() To: quic_zijuhu Cc: Bartosz Golaszewski , Bartosz Golaszewski , Krzysztof Kozlowski , Marcel Holtmann , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Wren Turkal Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Quic_zijuhu, On Wed, Apr 24, 2024 at 11:35=E2=80=AFAM quic_zijuhu wrote: > > On 4/24/2024 11:31 PM, Bartosz Golaszewski wrote: > > On Wed, Apr 24, 2024 at 5:30=E2=80=AFPM quic_zijuhu wrote: > >> > >> On 4/24/2024 11:24 PM, quic_zijuhu wrote: > >>> On 4/24/2024 10:52 PM, Bartosz Golaszewski wrote: > >>>> On Wed, 24 Apr 2024 at 16:46, Krzysztof Kozlowski > >>>> wrote: > >>>>> > >>>>> On 24/04/2024 14:29, Bartosz Golaszewski wrote: > >>>>>> From: Bartosz Golaszewski > >>>>>> > >>>>> > >>>>>> qcadev->susclk =3D devm_clk_get_optional(&serdev->de= v, NULL); > >>>>>> if (IS_ERR(qcadev->susclk)) { > >>>>>> @@ -2355,10 +2360,13 @@ static int qca_serdev_probe(struct serdev_= device *serdev) > >>>>>> qcadev->bt_en =3D devm_gpiod_get_optional(&serdev->d= ev, "enable", > >>>>>> GPIOD_OUT_LOW); > >>>>>> if (IS_ERR(qcadev->bt_en)) { > >>>>>> - dev_warn(&serdev->dev, "failed to acquire en= able gpio\n"); > >>>>>> - power_ctrl_enabled =3D false; > >>>>>> + dev_err(&serdev->dev, "failed to acquire ena= ble gpio\n"); > >>>>>> + return PTR_ERR(qcadev->bt_en); > >>> please think about for QCA2066. if it is returned from here. BT will > >>> not working at all. if you don't return here. i will be working fine > >>> for every BT functionality. > >> sorry, correct a type error, it is QCA6390 not QCA2066. > > > > Doesn't matter. If enable-gpios is not there, gpiod_get_optional() > > will return NULL and we will not return. > > > i think i need to explain more for my consider case. > let me take QCA6390, if the property enable-gpios is configured. > but IS_ERR(qcadev->bt_en) case happens, your change will do error > return, so BT will not work at all > > but if you don't do error return, BT will working fine. > > so your fix is not right regarding QCA6390. Actually I'd say he is probably right with respect to DT because that seems to require GPIO, we probably need a clearer way to differentiate if a device is being set up via DT or not (btattach), in any case DT is probably preferable thus why I went ahead and applied this one. > > Bart > > > >>> NAK again by me. > >>> > >>>>>> } > >>>>>> > >>>>>> + if (!qcadev->bt_en) > >>>>>> + power_ctrl_enabled =3D false; > >>>>> > >>>>> This looks duplicated - you already have such check earlier. > >>>>> > >>>> > >>>> It's under a different switch case! > >>>> > >>>> Bartosz > >>> > >>> > >> > --=20 Luiz Augusto von Dentz