Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp376187rdb; Thu, 15 Feb 2024 03:01:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUv+JKkSJ+cAe+1WbmdxHjqxl98a0W8qnwr10utOCtATH9uGlr85/iQZ4N//9JaWqi8g87zPLU5Sb3zQ2h+oJD75ZlXS+8/KRkTTLeoSw== X-Google-Smtp-Source: AGHT+IGWwQwTUkDD4EqAcE+wlqaN2SWunJNvRnNr3BBbMakVct1ejjmlWTJ5tGvSGLFYAz645w28 X-Received: by 2002:a05:6a00:1884:b0:6e1:29e2:1fbf with SMTP id x4-20020a056a00188400b006e129e21fbfmr620435pfh.5.1707994911702; Thu, 15 Feb 2024 03:01:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707994911; cv=pass; d=google.com; s=arc-20160816; b=K5iBCs0UktTJgVieCGb+3U26n91/4SSB2SJuel05yrg+VhlYrg12RsGeieeZc9DJlg TgymvI3wb7kDn/7g3brPXSHln9gQu9+e+fdrYiAXsk0BkfxoG4Cb+oEhGY/Fj98tLzrg mW4+dSZlpPaBnQF2ahvFfyn3DCZry+EQJEQZCArYMXEOtkAns0XE9AqS5tKYrxdqBFAN kVDMhbvZkTSU7h2oF/YqTbpuuTNxrIfyEDGv3ce/xdpYOKzWd98YiA5xT/mzz9uhPHmB OsTFZGnCkKGo7uf/bjg4trTe69cXYYOD29Isf+DyVou4DbAvbx4AL+tQP/2gsruRG0d/ nR8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=/Wdxu0sE9IUSNJ42xE/lp7GpCGh+HFnG98jqanftXw4=; fh=2ru081K0hyCP+lrbwo+J37s2lNNAzwLlNBOfgwL7/Lg=; b=nDomupqRByMYtAyqmHN/mF3ut2xnafAuL0DRDzx8g+l8oQTpfRsko0mI71tNi/pO+h 9VHfqBhy1dtqIXukL8l9l9enpioU24X0NEindJBq/AkwyAmeGYXyj4+u4USJFijLg5eH U0pfSmY3xHYmHjPdhUHpUeHnrHOTVJ7KH5sSuXJbwAIrYiosg6reYRN3erJi1fo6XLzL 1ETWKpf3+o5zGstGFoNvjLQOu+J9camcZM1iKwVYzDP76ph/i1FLIAO6dK6zEofD7NJb +j/J/XMN4vtoAPYUWhrj4jBsur69GyvvF4ZGABuN9TroZ9Fr2a+K+iJtfzutHOnYGKsE rywg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-66614-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66614-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id r5-20020aa79ec5000000b006e10e47ad08si948395pfq.355.2024.02.15.03.01.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 03:01:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66614-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-66614-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66614-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 656C6B2C1E0 for ; Thu, 15 Feb 2024 10:19:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0162D67E8B; Thu, 15 Feb 2024 10:19:27 +0000 (UTC) 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 D18406350A for ; Thu, 15 Feb 2024 10:19:23 +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=1707992366; cv=none; b=rvLjD2D1wjtSHtvqRgJpB96qD/L63522h4sAhMbhADY74aGVkpZV/HCW2/jfa21bMajoIwUlk5IYuCMFef/XN+3+RavsDPnwCFEESvLutx7/UwHvYYLxhZ91iJRDTt/yG2RRe/kHXxWhmZk2axOitkfNI8JPashhk7vGmVuFPaI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707992366; c=relaxed/simple; bh=u3rr8q+SLGsobq+2sOE/JWMdQphGfdS+OP4Y4ErJR1o=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=lUUi9obnFdP9xBKBAbakF6JeAshpMB8xJaWPui/D2ERhORXM7nUcTVVTpBaX4skDdAYav9ZrDgUbgZkiJn+xkl6dDokn2Z/4CIRfOFv1GTS/Wk+B7foBiDL8Tw+cPySbstYRjoi45+yqs2wLXVZn6bsbnMEqg2c0laBYxMG0vYA= 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 1raYpm-0006ML-Vw; Thu, 15 Feb 2024 11:19:15 +0100 Received: from [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.94.2) (envelope-from ) id 1raYpm-000reV-AH; Thu, 15 Feb 2024 11:19:14 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1raYpm-00041o-0n; Thu, 15 Feb 2024 11:19:14 +0100 Message-ID: Subject: Re: [PATCH 19/23] gpio: nomadik: grab optional reset control and deassert it at probe From: Philipp Zabel To: =?ISO-8859-1?Q?Th=E9o?= Lebrun , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, Gregory CLEMENT , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk Date: Thu, 15 Feb 2024 11:19:14 +0100 In-Reply-To: <20240214-mbly-gpio-v1-19-f88c0ccf372b@bootlin.com> References: <20240214-mbly-gpio-v1-0-f88c0ccf372b@bootlin.com> <20240214-mbly-gpio-v1-19-f88c0ccf372b@bootlin.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 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 Mi, 2024-02-14 at 17:24 +0100, Th=C3=A9o Lebrun wrote: > Fetch a reference to the optional shared reset control and deassert it > if it exists. >=20 > Optional because not all platforms that use this driver have a reset > attached to the reset block. Shared because some platforms that use the > reset (at least Mobileye EyeQ5) share the reset across banks. >=20 > Do not keep a reference to the reset control as it is not needed > afterwards; the driver does not handle suspend, does not use runtime PM > and does not register a remove callback. I suppose you don't care that the reset is only ever deasserted once and never asserted again on this hardware, but for shared reset controls the expectation is that deassert/assert calls are balanced: https://docs.kernel.org/driver-api/reset.html?highlight=3Dbalanced#assertio= n-and-deassertion So maybe this warrants a comment in the code. Or do you mean to suppress unbind via suppress_bind_attrs to explain away any missing cleanup? > The operation is done in nmk_gpio_populate_chip(). This function is > called by either gpio-nomadik or pinctrl-nomadik, whoever comes first. > This is here for historic reasons and could probably be removed now; it > seems gpio-ranges enforces the ordering to be pinctrl-first. It is not > the topic of the present patch however. >=20 > Signed-off-by: Th=C3=A9o Lebrun > --- > drivers/gpio/gpio-nomadik.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) >=20 > diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c > index 21bb6d6363fc..b623c093b54d 100644 > --- a/drivers/gpio/gpio-nomadik.c > +++ b/drivers/gpio/gpio-nomadik.c > @@ -513,12 +513,14 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(struct= device_node *np, > { > struct nmk_gpio_chip *nmk_chip; > struct platform_device *gpio_pdev; > + struct reset_control *reset; > struct gpio_chip *chip; > struct resource *res; > struct clk *clk; > void __iomem *base; > uintptr_t flags; > u32 id, ngpio; > + int ret; > =20 > gpio_pdev =3D of_find_device_by_node(np); > if (!gpio_pdev) { > @@ -576,6 +578,19 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(struct = device_node *np, > clk_prepare(clk); > nmk_chip->clk =3D clk; > =20 > + reset =3D devm_reset_control_get_optional_shared(&gpio_pdev->dev, NULL)= ; > + if (IS_ERR(reset)) { > + dev_err(&pdev->dev, "failed getting reset control: %ld\n", > + PTR_ERR(reset)); > + return ERR_CAST(reset); Consider using dev_err_probe() here. regards Philipp