public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-omap@vger.kernel.org
Cc: Dhruva Gole <d-gole@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: [RFC PATCH 1/4] reset: Fall back to lookup if no reset node is found
Date: Thu, 11 Apr 2024 08:22:54 +0300	[thread overview]
Message-ID: <20240411052257.2113-2-tony@atomide.com> (raw)
In-Reply-To: <20240411052257.2113-1-tony@atomide.com>

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

  reply	other threads:[~2024-04-11  5:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11  5:22 [RFC PATCH 0/4] Provide interconnect resets for ti-sysc users Tony Lindgren
2024-04-11  5:22 ` Tony Lindgren [this message]
2024-04-11  5:22 ` [RFC PATCH 2/4] reset: Allow removing a lookup Tony Lindgren
2024-04-11  5:22 ` [RFC PATCH 3/4] bus: ti-sysc: Implement reset control framework for soft reset Tony Lindgren
2024-04-11  5:22 ` [RFC PATCH 4/4] serial: 8250: omap: Use reset control for resets Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240411052257.2113-2-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=d-gole@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox