From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/3] reset: implement reset_control_get_optional()
Date: Fri, 5 Aug 2022 14:59:30 +0200 [thread overview]
Message-ID: <20220805125931.1212228-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220805125931.1212228-1-a.fatoum@pengutronix.de>
Make porting kernel code easier by providing a compatible
reset_control_get_optional() function.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/linux/reset.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/reset.h b/include/linux/reset.h
index d0677b1d9f63..91e9cdfb3279 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -73,4 +73,10 @@ static inline int device_reset_all(struct device_d *dev)
#endif /* CONFIG_RESET_CONTROLLER */
+static inline struct reset_control *reset_control_get_optional(struct device_d *dev, const char *id)
+{
+ struct reset_control *rstc = reset_control_get(dev, id);
+ return rstc == ERR_PTR(-ENOENT) ? NULL : rstc;
+}
+
#endif
--
2.30.2
next prev parent reply other threads:[~2022-08-05 13:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-05 12:59 [PATCH 1/3] reset: Fix of_reset_control_get() for consistent return values Ahmad Fatoum
2022-08-05 12:59 ` Ahmad Fatoum [this message]
2022-08-05 12:59 ` [PATCH 3/3] reset: implement reset_control_get_count() Ahmad Fatoum
2022-08-08 12:07 ` [PATCH 1/3] reset: Fix of_reset_control_get() for consistent return values Sascha Hauer
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=20220805125931.1212228-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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