[PATCH 2/3] reset: implement reset_control_get_optional()
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Aug 5 05:59:30 PDT 2022
Make porting kernel code easier by providing a compatible
reset_control_get_optional() function.
Signed-off-by: Ahmad Fatoum <a.fatoum at 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
More information about the barebox
mailing list