[PATCH 2/3] reset: implement reset_control_get_optional()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux