Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp329575rdb; Wed, 17 Jan 2024 03:27:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFy8j1uTDSTbxVWCB0tSltSFdSEx92/vCevin/xdMXanvidIIrn54oQbGue4abmiMwiY6fX X-Received: by 2002:a2e:a801:0:b0:2cd:b2f9:291c with SMTP id l1-20020a2ea801000000b002cdb2f9291cmr4668989ljq.38.1705490841475; Wed, 17 Jan 2024 03:27:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705490841; cv=pass; d=google.com; s=arc-20160816; b=GJ0yiPTw8KLaYiE+N6Ga4o1v3kUua4aY0FdXbiq0qD6b+znUHWqKHoqaMgBSQfiYim Wv/woSnEsjAsye2r/PUeaV2YFT84hKXrZGT81lL4HkAo52SzmTgC1npOX7ECYicLYrEu K6FAAIoHnBl7D1B/+VkkNUJDezaEsI4wZwVd9/XMnDBUCFQq5TPaNm5FBwBXTV+2g+hB tZRz7wRVND4A33+PSUm6QULX6lLm5d5fvXJs0EWijRoofxmNjZmX4riRJub5Wk0BkBRp wQseV2wPGV3fE1c5/X33vPWUwEcawH9+a1ZnbWvkfEQkeieRAzpXSbgSKYWsWuY8s897 J6Tw== 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=XeVJ9WS6DrN8KvnEEN9xLc6dJNsaroPd6eA6MGXWC3w=; fh=F8ji9ydEcr+tadhqbmJFB+4Ta/oLgk+7kM8RIQcuNHo=; b=KRR3+WfTF35xV9AqnIP/Os60Ix3c6PNEtqQxW1l1dZopxABZ4ts9AJ5r0FMY5oSrb7 zdSSofY8XdFzyWWHy19gkTD/hZBb9nbntXdFyqfxG8fK8EUdm98WIGX+R4CqI5QoYeDh YClJaNnDSyde9vJATdgb4OWigztDOVTA6uS7/chpBDhYdvry0/fsTH3VhdmDve5q33Ik fEH76B0mMQ1kqbQo4VGmELZ0b2Z/e3+4T8tlraxnd1nX+cvFOg7MAZWvxuFWFTY9ZCVC scf48wTXyzquKmTjVIXWA+87piDDgmDSgNVnAUBOQF5qHxMER6AHBnq/iGM8N70QEh3M eLEA== 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-28910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28910-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n16-20020a05640205d000b005548f93eb76si5906000edx.212.2024.01.17.03.27.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 03:27:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-28910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28910-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 356D21F248AC for ; Wed, 17 Jan 2024 11:27:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12ACA1DFC6; Wed, 17 Jan 2024 11:27:15 +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 4E9FB1DDF1 for ; Wed, 17 Jan 2024 11:27:13 +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=1705490834; cv=none; b=HdAbHcu/xGgfGOMzKXzCTPqmv1G+lAg2s62zOOJHWfqQhSycNiHBoXNVqcw93IQKqC9mnIoz5jdSyLdeewM1dNspiEGoi+6RUWUrVAgOoJ6OuiZ9/77BaPN7bSqO41SgtXwbXRN6V4HIJ3bkIoHK5zZHpU/xEYBFXiDTSF2tUc8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705490834; c=relaxed/simple; bh=jBx3eKRjN7Z9dDzc9bnlFlDn2eT7AJ7HfCKi7xPOw+c=; h=Received:Received:Received:Message-ID:Subject:From:To:Cc:Date: In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version:X-SA-Exim-Connect-IP:X-SA-Exim-Mail-From: X-SA-Exim-Scanned:X-PTX-Original-Recipient; b=MVB/u5VglfbQI5EFmxcueXyYw696DEhtzfg6eQzs8+JcPSS4xly5GedPqYZQniLsbbGLE/H/4I9AiZhiqiGtmvwY2nPrSbhlirb0eCycKzQiR2fSajTHhXEzJXZTj4i0O2wFUFAm8/uBOAJUAsd4c86mIkuiTeZhVa6j1Liliqw= 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 1rQ44L-00031s-OS; Wed, 17 Jan 2024 12:26:53 +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 1rQ44I-000S37-Tf; Wed, 17 Jan 2024 12:26:50 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1rQ44I-00054q-2g; Wed, 17 Jan 2024 12:26:50 +0100 Message-ID: <5ad7badb85bdece735901a0f6317183b1d628a68.camel@pengutronix.de> Subject: Re: [PATCH v3 2/5] reset: Instantiate reset GPIO controller for shared reset-gpios From: Philipp Zabel To: Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Rosin , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Bartosz Golaszewski , Chris Packham , Sean Anderson Date: Wed, 17 Jan 2024 12:26:50 +0100 In-Reply-To: <20240112163608.528453-3-krzysztof.kozlowski@linaro.org> References: <20240112163608.528453-1-krzysztof.kozlowski@linaro.org> <20240112163608.528453-3-krzysztof.kozlowski@linaro.org> 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 Fr, 2024-01-12 at 17:36 +0100, Krzysztof Kozlowski wrote: [...] > struct reset_control * > __of_reset_control_get(struct device_node *node, const char *id, int ind= ex, > bool shared, bool optional, bool acquired) > { > + struct of_phandle_args args =3D {0}; > + bool gpio_fallback =3D false; > struct reset_control *rstc; > - struct reset_controller_dev *r, *rcdev; > - struct of_phandle_args args; > + struct reset_controller_dev *rcdev; > int rstc_id; > int ret; > =20 > @@ -839,39 +1028,49 @@ __of_reset_control_get(struct device_node *node, c= onst char *id, int index, > index, &args); > if (ret =3D=3D -EINVAL) > return ERR_PTR(ret); > - if (ret) > - return optional ? NULL : ERR_PTR(ret); > + if (ret) { I think this should continue to return optional ? NULL : ERR_PTR(ret) if !IS_ENABLED(CONFIG_RESET_GPIO), for example by just skipping the of_parse_phandle_with_args(). That should allow the GPIO fallback in patch 5 to work as expected. > + /* > + * There can be only one reset-gpio for regular devices, so > + * don't bother with GPIO index. > + */ > + ret =3D of_parse_phandle_with_args(node, "reset-gpios", "#gpio-cells", > + 0, &args); > + if (ret) > + return optional ? NULL : ERR_PTR(ret); > =20 > - mutex_lock(&reset_list_mutex); > - rcdev =3D NULL; > - list_for_each_entry(r, &reset_controller_list, list) { > - if (args.np =3D=3D r->of_node) { > - rcdev =3D r; > - break; > + gpio_fallback =3D true; > + > + ret =3D __reset_add_reset_gpio_device(&args); > + if (ret) { > + rstc =3D ERR_PTR(ret); > + goto out_put; > } > } regards Philipp