* [PATCH] reset: core: reset-gpio: Suppress registration error for optional resets
@ 2025-10-02 22:28 Andre Przywara
2025-10-06 13:09 ` Philipp Zabel
0 siblings, 1 reply; 2+ messages in thread
From: Andre Przywara @ 2025-10-02 22:28 UTC (permalink / raw)
To: Philipp Zabel, Krzysztof Kozlowski
Cc: linux-sunxi, linux-kernel, linux-arm-kernel
For reset controllers that are marked as optional, we should skip errors
during probing and return NULL, to avoid unnecessary failures. The
reset-gpio controller does this mostly, but returns the true error in
case the __reset_add_reset_gpio_device() call fails. Treat this call the
same as the other registration errors, and consider the optional flag.
One could argue that at this point it's a proper error that should not
be ignored anymore, but in case of the reset-gpio controller this is not
entirely true, since the code at the moment does not support GPIO
controllers with three #gpio-cells - there is a TODO comment about this
in that said function. So to avoid unnecessary probe fails for devices
using reset-gpios (it's an optional reset after all), let's treat an
error as still optional at this point.
This fixes operation of WiFi chips on Allwinner boards, where some use
reset-gpios, and which currently fail because all Allwinner SoCs use
GPIO controllers with 3 cells.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
drivers/reset/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 22f67fc77ae53..c2ccd08fb36e1 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -1044,7 +1044,7 @@ __of_reset_control_get(struct device_node *node, const char *id, int index,
ret = __reset_add_reset_gpio_device(&args);
if (ret) {
- rstc = ERR_PTR(ret);
+ rstc = optional ? NULL : ERR_PTR(ret);
goto out_put;
}
}
--
2.46.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] reset: core: reset-gpio: Suppress registration error for optional resets
2025-10-02 22:28 [PATCH] reset: core: reset-gpio: Suppress registration error for optional resets Andre Przywara
@ 2025-10-06 13:09 ` Philipp Zabel
0 siblings, 0 replies; 2+ messages in thread
From: Philipp Zabel @ 2025-10-06 13:09 UTC (permalink / raw)
To: Andre Przywara, Krzysztof Kozlowski
Cc: linux-sunxi, linux-kernel, linux-arm-kernel
Hi Andre,
On Do, 2025-10-02 at 23:28 +0100, Andre Przywara wrote:
> For reset controllers that are marked as optional, we should skip errors
> during probing and return NULL, to avoid unnecessary failures. The
> reset-gpio controller does this mostly, but returns the true error in
> case the __reset_add_reset_gpio_device() call fails. Treat this call the
> same as the other registration errors, and consider the optional flag.
>
> One could argue that at this point it's a proper error that should not
> be ignored anymore, but in case of the reset-gpio controller this is not
> entirely true, since the code at the moment does not support GPIO
> controllers with three #gpio-cells - there is a TODO comment about this
> in that said function. So to avoid unnecessary probe fails for devices
> using reset-gpios (it's an optional reset after all), let's treat an
> error as still optional at this point.
>
> This fixes operation of WiFi chips on Allwinner boards, where some use
> reset-gpios, and which currently fail because all Allwinner SoCs use
> GPIO controllers with 3 cells.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
> drivers/reset/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index 22f67fc77ae53..c2ccd08fb36e1 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -1044,7 +1044,7 @@ __of_reset_control_get(struct device_node *node, const char *id, int index,
>
> ret = __reset_add_reset_gpio_device(&args);
> if (ret) {
> - rstc = ERR_PTR(ret);
> + rstc = optional ? NULL : ERR_PTR(ret);
Please move this into __reset_add_reset_gpio_device() and pass flags
into it. Only the -ENOENT return value mentioned in the commit
description should be suppressed by the optional flag, not any -ENOMEM.
And especially not the return value of __reset_add_reset_gpio_lookup(),
which may be -EPROBE_DEFER.
regards
Philipp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-06 13:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02 22:28 [PATCH] reset: core: reset-gpio: Suppress registration error for optional resets Andre Przywara
2025-10-06 13:09 ` Philipp Zabel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox