mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Siyuan <hsyysy@163.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH RESEND] reset: core: honour optional resets when the GPIO fallback is unusable
Date: Tue, 17 Nov 2026 17:20:08 +0800	[thread overview]
Message-ID: <20261117092008.12130-1-hsyysy@163.com> (raw)

__fwnode_reset_control_get() honours RESET_CONTROL_FLAGS_BIT_OPTIONAL for
every failure source except the reset-gpio fallback: when
__reset_add_reset_gpio_device() fails, the error is returned even for an
optional reset.

This is reachable on Allwinner SoCs, whose pinctrl uses three-cell GPIO
specifiers. The reset-gpio fallback only supports two cells, so it
returns -ENOENT and a consumer asking for an optional reset fails to
probe instead of falling back to its own GPIO handling. mmc-pwrseq-simple
on the Anbernic RG35XX family hits this: its wifi_pwrseq node has
reset-gpios but no resets, so the SDIO WiFi adapter never probes.

Keep propagating -EPROBE_DEFER, since the GPIO provider may be available
later, but treat any other failure as "no reset" when the request is
optional.

Fixes: c721f189e89c ("reset: Instantiate reset GPIO controller for shared reset-gpios")
Cc: stable@vger.kernel.org
Signed-off-by: Yang Siyuan <hsyysy@163.com>
---
 drivers/reset/core.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 38e189d04..f2375dd17 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -1181,7 +1181,17 @@ __fwnode_reset_control_get(struct fwnode_handle *fwnode, const char *id, int ind
 		ret = __reset_add_reset_gpio_device(fwnode, &args);
 		if (ret) {
 			fwnode_handle_put(args.fwnode);
-			return ERR_PTR(ret);
+
+			/*
+			 * The GPIO provider may just not be available yet, so
+			 * EPROBE_DEFER must always be propagated. Any other
+			 * failure means that the fallback cannot be used,
+			 * which is not an error for an optional reset.
+			 */
+			if (ret == -EPROBE_DEFER || !optional)
+				return ERR_PTR(ret);
+
+			return NULL;
 		}
 	}
 
base-commit: 091b06388b117fefdcb63336ac09956a4914b961
-- 
2.56.0


             reply	other threads:[~2026-11-17  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  9:20 Yang Siyuan [this message]
2026-11-17  9:49 ` Philipp Zabel
2026-11-17  9:55 ` [PATCH v2] reset: core: honour optional resets when the GPIO fallback returns -ENOENT Yang Siyuan
2026-11-17 10:30   ` Philipp Zabel

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=20261117092008.12130-1-hsyysy@163.com \
    --to=hsyysy@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®