[RFC PATCH 1/4] reset: Fall back to lookup if no reset node is found
From: Tony Lindgren
Date: Thu Apr 11 2024 - 01:23:59 EST
Fall back to lookup if the reset node does not exist. When creating and
removing subdevices on an interconnect, the parent device may provide
resets for the children using struct reset_control_lookup instead using
devicetree.
Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx>
---
drivers/reset/core.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -1141,12 +1141,17 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id,
int index, bool shared, bool optional,
bool acquired)
{
+ struct reset_control *rstc;
+
if (WARN_ON(shared && acquired))
return ERR_PTR(-EINVAL);
- if (dev->of_node)
- return __of_reset_control_get(dev->of_node, id, index, shared,
+ if (dev->of_node) {
+ rstc = __of_reset_control_get(dev->of_node, id, index, shared,
optional, acquired);
+ if (!(IS_ERR(rstc) && PTR_ERR(rstc) == -ENOENT))
+ return rstc;
+ }
return __reset_control_get_from_lookup(dev, id, shared, optional,
acquired);
--
2.44.0