From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 8388E2E228D for ; Wed, 19 Nov 2025 08:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763540411; cv=none; b=HZSJ+JLIFv8pVKG+nQ/bPy2PVknXfo/JN+HNoh5LIN+pLobKo31pIeAeLHoza/xvLWo1RmAWTRKf3I+4sfd46qv+wI/qR/7/yuRGKVT4f8gkBdrGLNUhKtELcOTnruQ5BUc3iQ1jThQrK66LCyLl39VRLg3Giu7NAtle1P1rm3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763540411; c=relaxed/simple; bh=7izO4jGvG7zAQewT9isaW9IXJG+kNjet9BQSQ1gu4Q8=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=qPHdBlFgyp1H1gcL2cyea4oKuQMJ8Zg1WK8YYDjxZYMp3yDFgnJJ/Y7ciV4TQg3ET35wFpGcZtHub9JUbxkk1W91jNmpvxsRK4J8mjps3LKabZ/82w/L56D6PJxucG1jSseJricf3VVEbKqAQIqdcacCqsNFjIJmy72u7BSOd98= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vLdPW-00004v-Tq; Wed, 19 Nov 2025 09:19:30 +0100 Received: from lupine.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::4e] helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vLdPW-001DRq-0g; Wed, 19 Nov 2025 09:19:30 +0100 Received: from pza by lupine with local (Exim 4.98.2) (envelope-from ) id 1vLdPW-000000001jH-0WqF; Wed, 19 Nov 2025 09:19:30 +0100 Message-ID: Subject: Re: [PATCH v6 8/8] reset: gpio: use software nodes to setup the GPIO lookup From: Philipp Zabel To: Bartosz Golaszewski Cc: Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Krzysztof Kozlowski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski Date: Wed, 19 Nov 2025 09:19:30 +0100 In-Reply-To: References: <20251106-reset-gpios-swnodes-v6-0-69aa852de9e4@linaro.org> <20251106-reset-gpios-swnodes-v6-8-69aa852de9e4@linaro.org> <0d251a35a438ebf3e14c6762df7ece079ee1d164.camel@pengutronix.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2-0+deb13u1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Di, 2025-11-18 at 18:08 +0100, Bartosz Golaszewski wrote: > On Tue, Nov 18, 2025 at 5:44=E2=80=AFPM Philipp Zabel wrote: > >=20 > > On Do, 2025-11-06 at 15:32 +0100, Bartosz Golaszewski wrote: > > > From: Bartosz Golaszewski > > >=20 > > > GPIO machine lookup is a nice mechanism for associating GPIOs with > > > consumers if we don't know what kind of device the GPIO provider is o= r > > > when it will become available. However in the case of the reset-gpio,= we > > > are already holding a reference to the device and so can reference it= s > > > firmware node. Let's setup a software node that references the releva= nt > > > GPIO and attach it to the auxiliary device we're creating. > > >=20 > > > Reviewed-by: Philipp Zabel > > > Acked-by: Linus Walleij > > > Signed-off-by: Bartosz Golaszewski > > > --- > >=20 > > I'll apply this with the following patch squashed in: Strike that, I'll have to wait for the SPI issue to be resolved. > > diff --git a/drivers/reset/core.c b/drivers/reset/core.c > > index 3edf04ae8a95..8a7b112a9a77 100644 > > --- a/drivers/reset/core.c > > +++ b/drivers/reset/core.c > > @@ -945,7 +945,7 @@ static int __reset_add_reset_gpio_device(const stru= ct of_phandle_args *args) > > of_node_get(rgpio_dev->of_args.np); > >=20 > > rgpio_dev->swnode =3D fwnode_create_software_node(properties, N= ULL); > > - ret =3D PTR_ERR(rgpio_dev->swnode); > > + ret =3D PTR_ERR_OR_ZERO(rgpio_dev->swnode); > > if (ret) > > goto err_put_of_node; >=20 > Huh? Why? PTR_ERR(ptr) is just (long)ptr, so a valid swnode pointer makes ret non-zero and takes us into the error path. PTR_ERR_OR_ZERO() includes the IS_ERR() check and returns 0 for non-error pointers. And there is a (false-positive) sparse warning: drivers/reset/core.c:978 __reset_add_reset_gpio_device() warn: passing zer= o to 'PTR_ERR' I think it would be better to return to the explicit IS_ERR() check from v5. regards Philipp