
17 Jan
2024
17 Jan
'24
1:26 p.m.
On Fr, 2024-01-12 at 17:36 +0100, Krzysztof Kozlowski wrote: [...]
struct reset_control * __of_reset_control_get(struct device_node *node, const char *id, int index, bool shared, bool optional, bool acquired) {
- struct of_phandle_args args = {0};
- bool gpio_fallback = false; struct reset_control *rstc;
- struct reset_controller_dev *r, *rcdev;
- struct of_phandle_args args;
- struct reset_controller_dev *rcdev; int rstc_id; int ret;
@@ -839,39 +1028,49 @@ __of_reset_control_get(struct device_node *node, const char *id, int index, index, &args); if (ret == -EINVAL) return ERR_PTR(ret);
- if (ret)
return optional ? NULL : ERR_PTR(ret);
- if (ret) {
I think this should continue to return optional ? NULL : ERR_PTR(ret) if !IS_ENABLED(CONFIG_RESET_GPIO), for example by just skipping the of_parse_phandle_with_args(). That should allow the GPIO fallback in patch 5 to work as expected.
/*
* There can be only one reset-gpio for regular devices, so
* don't bother with GPIO index.
*/
ret = of_parse_phandle_with_args(node, "reset-gpios", "#gpio-cells",
0, &args);
if (ret)
return optional ? NULL : ERR_PTR(ret);
- mutex_lock(&reset_list_mutex);
- rcdev = NULL;
- list_for_each_entry(r, &reset_controller_list, list) {
if (args.np == r->of_node) {
rcdev = r;
break;
gpio_fallback = true;
ret = __reset_add_reset_gpio_device(&args);
if (ret) {
rstc = ERR_PTR(ret);
} }goto out_put;
regards Philipp