add clk_valid() to check for optional clocks are valid.

Signed-off-by: Fabrice Gasnier <fabrice.gasn...@st.com>
---

 include/clk.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/clk.h b/include/clk.h
index 9a35764..71679a9 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -294,4 +294,14 @@ int clk_disable_bulk(struct clk_bulk *bulk);
 
 int soc_clk_dump(void);
 
+/**
+ * clk_valid() - check if clk is valid
+ *
+ * @clk:       the clock to check
+ * @return TRUE if valid, or FALSE
+ */
+static inline bool clk_valid(struct clk *clk)
+{
+       return !!clk->dev;
+}
 #endif
-- 
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to