···16521652}1653165316541654/**16551655+ * clk_has_parent - check if a clock is a possible parent for another16561656+ * @clk: clock source16571657+ * @parent: parent clock source16581658+ *16591659+ * This function can be used in drivers that need to check that a clock can be16601660+ * the parent of another without actually changing the parent.16611661+ *16621662+ * Returns true if @parent is a possible parent for @clk, false otherwise.16631663+ */16641664+bool clk_has_parent(struct clk *clk, struct clk *parent)16651665+{16661666+ unsigned int i;16671667+16681668+ /* NULL clocks should be nops, so return success if either is NULL. */16691669+ if (!clk || !parent)16701670+ return true;16711671+16721672+ /* Optimize for the case where the parent is already the parent. */16731673+ if (clk->parent == parent)16741674+ return true;16751675+16761676+ for (i = 0; i < clk->num_parents; i++)16771677+ if (strcmp(clk->parent_names[i], parent->name) == 0)16781678+ return true;16791679+16801680+ return false;16811681+}16821682+EXPORT_SYMBOL_GPL(clk_has_parent);16831683+16841684+/**16551685 * clk_set_parent - switch the parent of a mux clk16561686 * @clk: the mux clk whose input we are switching16571687 * @parent: the new input to clk
+17
include/linux/clk.h
···302302int clk_set_rate(struct clk *clk, unsigned long rate);303303304304/**305305+ * clk_has_parent - check if a clock is a possible parent for another306306+ * @clk: clock source307307+ * @parent: parent clock source308308+ *309309+ * This function can be used in drivers that need to check that a clock can be310310+ * the parent of another without actually changing the parent.311311+ *312312+ * Returns true if @parent is a possible parent for @clk, false otherwise.313313+ */314314+bool clk_has_parent(struct clk *clk, struct clk *parent);315315+316316+/**305317 * clk_set_parent - set the parent clock source for this clock306318 * @clk: clock source307319 * @parent: parent clock source···384372static inline long clk_round_rate(struct clk *clk, unsigned long rate)385373{386374 return 0;375375+}376376+377377+static inline bool clk_has_parent(struct clk *clk, struct clk *parent)378378+{379379+ return true;387380}388381389382static inline int clk_set_parent(struct clk *clk, struct clk *parent)