summaryrefslogtreecommitdiff
path: root/drivers/clk
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2019-11-11 16:07:45 +0300
committerThierry Reding <treding@nvidia.com>2019-11-11 16:07:45 +0300
commit73616d0d7e48d564ee8e63ad845f86d69c566264 (patch)
tree0253c3ec00aae0720193217e5c97b85dd138eec8 /drivers/clk
parented1a2459e20c0dfc9d184230c480ace439bececb (diff)
parentd9b86cc48283112f06738d45031b88bd3f9ecb92 (diff)
downloadlinux-73616d0d7e48d564ee8e63ad845f86d69c566264.tar.xz
Merge branch 'for-5.5/clk-core' into for-5.5/clk
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 1c677d7f7f53..f8ed6e613436 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1674,6 +1674,24 @@ static int clk_fetch_parent_index(struct clk_core *core,
return i;
}
+/**
+ * clk_hw_get_parent_index - return the index of the parent clock
+ * @hw: clk_hw associated with the clk being consumed
+ *
+ * Fetches and returns the index of parent clock. Returns -EINVAL if the given
+ * clock does not have a current parent.
+ */
+int clk_hw_get_parent_index(struct clk_hw *hw)
+{
+ struct clk_hw *parent = clk_hw_get_parent(hw);
+
+ if (WARN_ON(parent == NULL))
+ return -EINVAL;
+
+ return clk_fetch_parent_index(hw->core, parent->core);
+}
+EXPORT_SYMBOL_GPL(clk_hw_get_parent_index);
+
/*
* Update the orphan status of @core and all its children.
*/