summaryrefslogtreecommitdiff
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@kernel.org>2018-12-11 19:34:16 +0300
committerStephen Boyd <sboyd@kernel.org>2019-03-01 22:17:22 +0300
commitefa850487a6b6742699e3352d8562f5aba531ae7 (patch)
tree44515c79e2a05d5602cfbade81753302222a5c86 /drivers/clk/clk.c
parent4472287a3b2f52f4aa53f294ccb74392dde4e07d (diff)
downloadlinux-efa850487a6b6742699e3352d8562f5aba531ae7.tar.xz
clk: Inform the core about consumer devices
We'd like to have a pointer to the device that's consuming a particular clk in the clk framework so we can link the consumer to the clk provider with a PM device link. Add a device argument to clk_hw_create_clk() for this so it can be used in subsequent patches to add and remove the link. Cc: Miquel Raynal <miquel.raynal@bootlin.com> Cc: Jerome Brunet <jbrunet@baylibre.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Michael Turquette <mturquette@baylibre.com> Cc: Jeffrey Hugo <jhugo@codeaurora.org> Cc: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 04288063847b..8244ef2ba977 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -82,6 +82,7 @@ struct clk_core {
struct clk {
struct clk_core *core;
+ struct device *dev;
const char *dev_id;
const char *con_id;
unsigned long min_rate;
@@ -3273,6 +3274,7 @@ static void free_clk(struct clk *clk)
/**
* clk_hw_create_clk: Allocate and link a clk consumer to a clk_core given
* a clk_hw
+ * @dev: clk consumer device
* @hw: clk_hw associated with the clk being consumed
* @dev_id: string describing device name
* @con_id: connection ID string on device
@@ -3281,7 +3283,7 @@ static void free_clk(struct clk *clk)
* consumers. It connects a consumer to the clk_core and clk_hw structures
* used by the framework and clk provider respectively.
*/
-struct clk *clk_hw_create_clk(struct clk_hw *hw,
+struct clk *clk_hw_create_clk(struct device *dev, struct clk_hw *hw,
const char *dev_id, const char *con_id)
{
struct clk *clk;
@@ -3295,6 +3297,7 @@ struct clk *clk_hw_create_clk(struct clk_hw *hw,
clk = alloc_clk(core, dev_id, con_id);
if (IS_ERR(clk))
return clk;
+ clk->dev = dev;
if (!try_module_get(core->owner)) {
free_clk(clk);
@@ -4149,7 +4152,7 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
{
struct clk_hw *hw = of_clk_get_hw_from_clkspec(clkspec);
- return clk_hw_create_clk(hw, NULL, __func__);
+ return clk_hw_create_clk(NULL, hw, NULL, __func__);
}
EXPORT_SYMBOL_GPL(of_clk_get_from_provider);