[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5ad7badb85bdece735901a0f6317183b1d628a68.camel@pengutronix.de>
Date: Wed, 17 Jan 2024 12:26:50 +0100
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>, Bjorn Andersson
<andersson@...nel.org>, Konrad Dybcio <konrad.dybcio@...aro.org>, Srinivas
Kandagatla <srinivas.kandagatla@...aro.org>, Banajit Goswami
<bgoswami@...cinc.com>, Liam Girdwood <lgirdwood@...il.com>, Mark Brown
<broonie@...nel.org>, Rob Herring <robh+dt@...nel.org>, Krzysztof Kozlowski
<krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor+dt@...nel.org>,
Peter Rosin <peda@...ntia.se>, Jaroslav Kysela <perex@...ex.cz>, Takashi
Iwai <tiwai@...e.com>, linux-arm-msm@...r.kernel.org,
alsa-devel@...a-project.org, linux-sound@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-i2c@...r.kernel.org
Cc: Bartosz Golaszewski <brgl@...ev.pl>, Chris Packham
<chris.packham@...iedtelesis.co.nz>, Sean Anderson <sean.anderson@...o.com>
Subject: Re: [PATCH v3 2/5] reset: Instantiate reset GPIO controller for
shared reset-gpios
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
Powered by blists - more mailing lists