Re: [GIT PULL] clk: ti: updates for v4.20

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Tero Kristo (2018-10-03 06:12:39)
> Hi Mike, Stephen,
> 
> Here are the late changes for TI clock driver for 4.20 merge window. 
> Sorry about the late pull request, but this was waiting for resolution 
> on one of the dependencies (patch "clk: ti: fix OF child-node 
> lookup..."). Thanks for setting up the immutable branch for it.
> 
> Please especially note the core clock changes in this series for adding 
> support of clk save/restore mechanism (two patches from Russ Dill.) I 
> decided to go ahead by adding them to this pull as there has been no 
> comments on the patches and they have been pending on the lists already 
> for a while. They aren't touching anything existing either, so they 
> should be safe to apply also.

Thanks for calling it out and pushing me to react. I have been avoiding
the suspend/resume patches unsuccessfully and now after looking at them
I see a few nitpicks that I can resolve after merging this PR. It's also
a sort of one-off solution for TI where all clks need to run through
save/restore in a depth-first tree order and just blast in
enable/disable bits, so we'll need to improve on it in the future. But
I'm fine to go with it for now and do _something_ instead of just sit
around and do nothing.

----8<----

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index dd775771a7cc..af011974d4ec 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -935,39 +935,41 @@ static int clk_core_enable_lock(struct clk_core *core)
  */
 void clk_gate_restore_context(struct clk_hw *hw)
 {
-	if (hw->clk->core->enable_count)
-		hw->clk->core->ops->enable(hw);
+	struct clk_core *core = hw->core;
+
+	if (core->enable_count)
+		core->ops->enable(hw);
 	else
-		hw->clk->core->ops->disable(hw);
+		core->ops->disable(hw);
 }
 EXPORT_SYMBOL_GPL(clk_gate_restore_context);
 
-static int _clk_save_context(struct clk_core *clk)
+static int clk_core_save_context(struct clk_core *core)
 {
 	struct clk_core *child;
 	int ret = 0;
 
-	hlist_for_each_entry(child, &clk->children, child_node) {
-		ret = _clk_save_context(child);
+	hlist_for_each_entry(child, &core->children, child_node) {
+		ret = clk_core_save_context(child);
 		if (ret < 0)
 			return ret;
 	}
 
-	if (clk->ops && clk->ops->save_context)
-		ret = clk->ops->save_context(clk->hw);
+	if (core->ops && core->ops->save_context)
+		ret = core->ops->save_context(core->hw);
 
 	return ret;
 }
 
-static void _clk_restore_context(struct clk_core *clk)
+static void clk_core_restore_context(struct clk_core *core)
 {
 	struct clk_core *child;
 
-	if (clk->ops && clk->ops->restore_context)
-		clk->ops->restore_context(clk->hw);
+	if (core->ops && core->ops->restore_context)
+		core->ops->restore_context(core->hw);
 
-	hlist_for_each_entry(child, &clk->children, child_node)
-		_clk_restore_context(child);
+	hlist_for_each_entry(child, &core->children, child_node)
+		clk_core_restore_context(child);
 }
 
 /**
@@ -983,13 +985,13 @@ int clk_save_context(void)
 	int ret;
 
 	hlist_for_each_entry(clk, &clk_root_list, child_node) {
-		ret = _clk_save_context(clk);
+		ret = clk_core_save_context(clk);
 		if (ret < 0)
 			return ret;
 	}
 
 	hlist_for_each_entry(clk, &clk_orphan_list, child_node) {
-		ret = _clk_save_context(clk);
+		ret = clk_core_save_context(clk);
 		if (ret < 0)
 			return ret;
 	}
@@ -1006,13 +1008,13 @@ EXPORT_SYMBOL_GPL(clk_save_context);
  */
 void clk_restore_context(void)
 {
-	struct clk_core *clk;
+	struct clk_core *core;
 
-	hlist_for_each_entry(clk, &clk_root_list, child_node)
-		_clk_restore_context(clk);
+	hlist_for_each_entry(core, &clk_root_list, child_node)
+		clk_core_restore_context(core);
 
-	hlist_for_each_entry(clk, &clk_orphan_list, child_node)
-		_clk_restore_context(clk);
+	hlist_for_each_entry(core, &clk_orphan_list, child_node)
+		clk_core_restore_context(core);
 }
 EXPORT_SYMBOL_GPL(clk_restore_context);
 





[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux