The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [RFC PATCH] reset: always bail out on missing RESET_GPIO driver
@ 2025-10-15 11:28 Wolfram Sang
  2025-10-15 14:30 ` Philipp Zabel
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2025-10-15 11:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Kuninori Morimoto, Krzysztof Kozlowski, linux-kernel,
	Wolfram Sang, Philipp Zabel

Optional GPIOs mean they can be omitted. If they are described, a
failure in acquiring them still needs to be reported. When the
RESET_GPIO is not enabled so the reset core cannot provide its assumed
fallback, the user should be informed about it. So, not only bail out
but also give a hint how to fix the situation.

Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Closes: https://lore.kernel.org/r/87a51um1y1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

This happened because of this (in general) nice cleanup patch for the
pca954x driver (690de2902dca ("i2c: muxes: pca954x: Use reset controller
only")). Our .config didn't have the RESET_GPIO enabled before, so sound
regressed on some boards.

Actually, my preferred solution would be to make the reset-gpio driver
'obj-y' but I guess its dependency on GPIOLIB makes this a no-go?

On the other hand, the fallback is a really nice feature which could
remove duplicated code. But if the fallback is not present by default,
it makes it cumbersome to use IMO.

Has this been discussed before? I couldn't find any pointers...

Happy hacking, everyone!


 drivers/reset/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 22f67fc77ae5..8a0f41963f6b 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -1028,8 +1028,10 @@ __of_reset_control_get(struct device_node *node, const char *id, int index,
 	if (ret == -EINVAL)
 		return ERR_PTR(ret);
 	if (ret) {
-		if (!IS_ENABLED(CONFIG_RESET_GPIO))
-			return optional ? NULL : ERR_PTR(ret);
+		if (!IS_ENABLED(CONFIG_RESET_GPIO)) {
+			pr_warn("%s(): RESET_GPIO driver not enabled, cannot fall back\n", __func__);
+			return ERR_PTR(ret);
+		}
 
 		/*
 		 * There can be only one reset-gpio for regular devices, so
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-15 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 11:28 [RFC PATCH] reset: always bail out on missing RESET_GPIO driver Wolfram Sang
2025-10-15 14:30 ` Philipp Zabel
2025-10-15 18:08   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox