reset: core: reset-gpio: Suppress registration error for optional resets
Subsystems (2)
PATCH 1/1 reset: core: reset-gpio: Suppress registration error for optional resets
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.
--- drivers/reset/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/reset/core.c +1 -1
@@ -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; } }
Signature · 1 line
2.46.4
Philipp Zabel
maintainerHi Andre,
Quoted 28 lines · Andre Przywara
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 <[email protected]>--- drivers/reset/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/reset/core.c +0
-0
drivers/reset/core.c __of_reset_control_get(struct device_node *node, const char *id, int index, · line 1047
Quoted 5 lines
drivers/reset/core.c +1
-1@@ -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