diff mbox series

[RFC,1/4] reset: Fall back to lookup if no reset node is found

Message ID 20240411052257.2113-2-tony@atomide.com
State New
Headers show
Series Provide interconnect resets for ti-sysc users | expand

Commit Message

Tony Lindgren April 11, 2024, 5:22 a.m. UTC
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@atomide.com>
---
 drivers/reset/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

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);