[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251015205919.12678-5-wsa+renesas@sang-engineering.com>
Date: Wed, 15 Oct 2025 22:59:21 +0200
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: linux-renesas-soc@...r.kernel.org
Cc: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
linux-kernel@...r.kernel.org,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Philipp Zabel <p.zabel@...gutronix.de>
Subject: [PATCH v2 1/2] reset: always bail out on missing RESET_GPIO driver
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. This means the check has
to be moved after ensuring the GPIO is really described.
Signed-off-by: Wolfram Sang <wsa+renesas@...g-engineering.com>
---
Changes since RFC v1:
* moved the code after second phandle check
* switched to pr_err
* updated commit message
* moved Reported-by to patch 2
drivers/reset/core.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 22f67fc77ae5..c1909074f715 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -1028,9 +1028,6 @@ __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);
-
/*
* There can be only one reset-gpio for regular devices, so
* don't bother with the "reset-gpios" phandle index.
@@ -1040,6 +1037,11 @@ __of_reset_control_get(struct device_node *node, const char *id, int index,
if (ret)
return optional ? NULL : ERR_PTR(ret);
+ if (!IS_ENABLED(CONFIG_RESET_GPIO)) {
+ pr_err("%s(): RESET_GPIO driver not enabled, cannot fall back\n", __func__);
+ return ERR_PTR(-ENOEXEC);
+ }
+
gpio_fallback = true;
ret = __reset_add_reset_gpio_device(&args);
--
2.47.2
Powered by blists - more mailing lists