devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Banajit Goswami <bgoswami@quicinc.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Peter Rosin <peda@axentia.se>, Jaroslav Kysela <perex@perex.cz>,
	 Takashi Iwai <tiwai@suse.com>,
	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 <brgl@bgdev.pl>,
	Chris Packham <chris.packham@alliedtelesis.co.nz>,
	Sean Anderson <sean.anderson@seco.com>
Subject: Re: [PATCH v3 2/5] reset: Instantiate reset GPIO controller for shared reset-gpios
Date: Wed, 17 Jan 2024 12:26:50 +0100	[thread overview]
Message-ID: <5ad7badb85bdece735901a0f6317183b1d628a68.camel@pengutronix.de> (raw)
In-Reply-To: <20240112163608.528453-3-krzysztof.kozlowski@linaro.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 index,
>  		       bool shared, bool optional, bool acquired)
>  {
> +	struct of_phandle_args args = {0};
> +	bool gpio_fallback = 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;
>  
> @@ -839,39 +1028,49 @@ __of_reset_control_get(struct device_node *node, const char *id, int index,
>  					 index, &args);
>  	if (ret == -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 = of_parse_phandle_with_args(node, "reset-gpios", "#gpio-cells",
> +						 0, &args);
> +		if (ret)
> +			return optional ? NULL : ERR_PTR(ret);
>  
> -	mutex_lock(&reset_list_mutex);
> -	rcdev = NULL;
> -	list_for_each_entry(r, &reset_controller_list, list) {
> -		if (args.np == r->of_node) {
> -			rcdev = r;
> -			break;
> +		gpio_fallback = true;
> +
> +		ret = __reset_add_reset_gpio_device(&args);
> +		if (ret) {
> +			rstc = ERR_PTR(ret);
> +			goto out_put;
>  		}
>  	}

regards
Philipp

  parent reply	other threads:[~2024-01-17 11:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 16:36 [PATCH v3 0/5] reset: gpio: ASoC: shared GPIO resets Krzysztof Kozlowski
2024-01-12 16:36 ` [PATCH v3 1/5] reset: gpio: Add GPIO-based reset controller Krzysztof Kozlowski
2024-01-15 14:44   ` Bartosz Golaszewski
2024-01-12 16:36 ` [PATCH v3 2/5] reset: Instantiate reset GPIO controller for shared reset-gpios Krzysztof Kozlowski
2024-01-15 16:06   ` Bartosz Golaszewski
2024-01-15 16:13     ` Krzysztof Kozlowski
2024-01-15 17:32       ` Philipp Zabel
2024-01-22 13:02         ` Krzysztof Kozlowski
2024-01-15 16:55   ` Philipp Zabel
2024-01-22 13:11     ` Krzysztof Kozlowski
2024-01-17 11:26   ` Philipp Zabel [this message]
2024-01-22 13:14     ` Krzysztof Kozlowski
2024-01-12 16:36 ` [PATCH v3 3/5] ASoC: dt-bindings: qcom,wsa8840: Add reset-gpios for shared line Krzysztof Kozlowski
2024-01-16 18:27   ` Rob Herring
2024-01-12 16:36 ` [PATCH v3 4/5] ASoC: codecs: wsa884x: Allow sharing reset GPIO Krzysztof Kozlowski
2024-01-12 16:36 ` [PATCH v3 5/5] i2c: muxes: pca954x: " Krzysztof Kozlowski
2024-01-16 15:18   ` Philipp Zabel
2024-01-16 19:58     ` Chris Packham
2024-01-17 11:16       ` Philipp Zabel
2024-01-17 19:56         ` Chris Packham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ad7badb85bdece735901a0f6317183b1d628a68.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=andersson@kernel.org \
    --cc=bgoswami@quicinc.com \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=sean.anderson@seco.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).