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 4C715331A59 for ; Wed, 22 Oct 2025 14:45:43 +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=1761144345; cv=none; b=K/v+7SaZdr52VzzeRd7/5+yF0YRAxfXqoqC83o0xwqlQf/qBLLEZj49CNeCh9RproDFkboXvKmXAEzH9/jvBURnoSHOn5kQOGcFD7D4tcuiuEabsX7mc+AofupRUo3Q/dNagCb2HzrsALqjrJuNHi0loYe+KPPSIjpFiJ63/8tI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761144345; c=relaxed/simple; bh=tSw6rQZlMQn+CQgaVhZKZ/LPnP71EM4OXUrLskqgNhI=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=ZE5AtAujYzUzmI1TnNTSqrqk17HQPngiZmgnSHXy7ETXDoy5GJIdmaa5z1wyXGvDgr07fSrYiGgIhZ5yK1fRp+V6HmjKAHMJxjyoM4ISZYPpLGDYjEpu5NaI9wxdEZyXL4bfP4Ix7GD+JbKZpVE6Y6P+970n5lj9J0mLNch5tuI= 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 1vBa5f-00088u-0v; Wed, 22 Oct 2025 16:45:27 +0200 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 1vBa5e-004uKx-0o; Wed, 22 Oct 2025 16:45:26 +0200 Received: from pza by lupine with local (Exim 4.98.2) (envelope-from ) id 1vBa5e-00000000BDI-0hMt; Wed, 22 Oct 2025 16:45:26 +0200 Message-ID: <939b13c69ade5e574c33777bc4f7b368f83764ff.camel@pengutronix.de> Subject: Re: [PATCH v2 9/9] reset: gpio: use software nodes to setup the GPIO lookup From: Philipp Zabel To: Bartosz Golaszewski , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Krzysztof Kozlowski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski Date: Wed, 22 Oct 2025 16:45:25 +0200 In-Reply-To: <20251022-reset-gpios-swnodes-v2-9-69088530291b@linaro.org> References: <20251022-reset-gpios-swnodes-v2-0-69088530291b@linaro.org> <20251022-reset-gpios-swnodes-v2-9-69088530291b@linaro.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.1-1 Precedence: bulk X-Mailing-List: linux-gpio@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-gpio@vger.kernel.org On Mi, 2025-10-22 at 15:41 +0200, 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 or > 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 its > firmware node. Let's setup a software node that references the relevant > GPIO and attach it to the auxiliary device we're creating. >=20 > Signed-off-by: Bartosz Golaszewski > --- > drivers/reset/core.c | 131 ++++++++++++++++++++++++++++++---------------= ------ > 1 file changed, 77 insertions(+), 54 deletions(-) >=20 > diff --git a/drivers/reset/core.c b/drivers/reset/core.c > index c9f13020ca3a7b9273488497a7d4240d0af762b0..20378de4b813ab79a103ea81c= f2cbcd2b76c0ccf 100644 > --- a/drivers/reset/core.c > +++ b/drivers/reset/core.c [...] > @@ -915,11 +913,30 @@ static int __reset_add_reset_gpio_device(const stru= ct of_phandle_args *args) > if (args->args_count !=3D 2) > return -ENOENT; > =20 > + offset =3D args->args[0]; > + of_flags =3D args->args[1]; > + > + /* > + * Later we map GPIO flags between OF and Linux, however not all > + * constants from include/dt-bindings/gpio/gpio.h and > + * include/linux/gpio/machine.h match each other. > + * > + * FIXME: Find a better way of translating OF flags to GPIO lookup > + * flags. > + */ > + if (of_flags > GPIO_ACTIVE_LOW) { > + pr_err("reset-gpio code does not support GPIO flags %u for GPIO %u\n", > + of_flags, offset); > + return -EINVAL; > + } > + Please move this ... > struct gpio_device *gdev __free(gpio_device_put) =3D > gpio_device_find_by_fwnode(of_fwnode_handle(args->np)); > if (!gdev) > return -EPROBE_DEFER; > =20 > + parent =3D gpio_device_to_device(gdev); > + ... and this after the lockdep_asset_held() below. With that, Reviewed-by: Philipp Zabel regards Philipp