|
@@ -2169,6 +2169,32 @@ int clk_get_phase(struct clk *clk)
|
|
|
return clk_core_get_phase(clk->core);
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * clk_is_match - check if two clk's point to the same hardware clock
|
|
|
+ * @p: clk compared against q
|
|
|
+ * @q: clk compared against p
|
|
|
+ *
|
|
|
+ * Returns true if the two struct clk pointers both point to the same hardware
|
|
|
+ * clock node. Put differently, returns true if struct clk *p and struct clk *q
|
|
|
+ * share the same struct clk_core object.
|
|
|
+ *
|
|
|
+ * Returns false otherwise. Note that two NULL clks are treated as matching.
|
|
|
+ */
|
|
|
+bool clk_is_match(const struct clk *p, const struct clk *q)
|
|
|
+{
|
|
|
+ /* trivial case: identical struct clk's or both NULL */
|
|
|
+ if (p == q)
|
|
|
+ return true;
|
|
|
+
|
|
|
+ /* true if clk->core pointers match. Avoid derefing garbage */
|
|
|
+ if (!IS_ERR_OR_NULL(p) && !IS_ERR_OR_NULL(q))
|
|
|
+ if (p->core == q->core)
|
|
|
+ return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(clk_is_match);
|
|
|
+
|
|
|
/**
|
|
|
* __clk_init - initialize the data structures in a struct clk
|
|
|
* @dev: device initializing this clk, placeholder for now
|