Make porting kernel code easier by providing a compatible
reset_control_get_optional() function.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 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


Reply via email to