Commit 9be76627 authored by Stephen Boyd's avatar Stephen Boyd

clk: Clean up suspend/resume coding style

The normal style is to use 'core' for struct clk_core pointers and to
directly access the core pointer from the clk_hw pointer when we're
within the common clk framework. Update the patches to make it a bit
easier to handle.
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 3d306221
...@@ -935,39 +935,41 @@ static int clk_core_enable_lock(struct clk_core *core) ...@@ -935,39 +935,41 @@ static int clk_core_enable_lock(struct clk_core *core)
*/ */
void clk_gate_restore_context(struct clk_hw *hw) void clk_gate_restore_context(struct clk_hw *hw)
{ {
if (hw->clk->core->enable_count) struct clk_core *core = hw->core;
hw->clk->core->ops->enable(hw);
if (core->enable_count)
core->ops->enable(hw);
else else
hw->clk->core->ops->disable(hw); core->ops->disable(hw);
} }
EXPORT_SYMBOL_GPL(clk_gate_restore_context); 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; struct clk_core *child;
int ret = 0; int ret = 0;
hlist_for_each_entry(child, &clk->children, child_node) { hlist_for_each_entry(child, &core->children, child_node) {
ret = _clk_save_context(child); ret = clk_core_save_context(child);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
if (clk->ops && clk->ops->save_context) if (core->ops && core->ops->save_context)
ret = clk->ops->save_context(clk->hw); ret = core->ops->save_context(core->hw);
return ret; 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; struct clk_core *child;
if (clk->ops && clk->ops->restore_context) if (core->ops && core->ops->restore_context)
clk->ops->restore_context(clk->hw); core->ops->restore_context(core->hw);
hlist_for_each_entry(child, &clk->children, child_node) hlist_for_each_entry(child, &core->children, child_node)
_clk_restore_context(child); clk_core_restore_context(child);
} }
/** /**
...@@ -983,13 +985,13 @@ int clk_save_context(void) ...@@ -983,13 +985,13 @@ int clk_save_context(void)
int ret; int ret;
hlist_for_each_entry(clk, &clk_root_list, child_node) { hlist_for_each_entry(clk, &clk_root_list, child_node) {
ret = _clk_save_context(clk); ret = clk_core_save_context(clk);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
hlist_for_each_entry(clk, &clk_orphan_list, child_node) { hlist_for_each_entry(clk, &clk_orphan_list, child_node) {
ret = _clk_save_context(clk); ret = clk_core_save_context(clk);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
...@@ -1006,13 +1008,13 @@ EXPORT_SYMBOL_GPL(clk_save_context); ...@@ -1006,13 +1008,13 @@ EXPORT_SYMBOL_GPL(clk_save_context);
*/ */
void clk_restore_context(void) void clk_restore_context(void)
{ {
struct clk_core *clk; struct clk_core *core;
hlist_for_each_entry(clk, &clk_root_list, child_node) hlist_for_each_entry(core, &clk_root_list, child_node)
_clk_restore_context(clk); clk_core_restore_context(core);
hlist_for_each_entry(clk, &clk_orphan_list, child_node) hlist_for_each_entry(core, &clk_orphan_list, child_node)
_clk_restore_context(clk); clk_core_restore_context(core);
} }
EXPORT_SYMBOL_GPL(clk_restore_context); EXPORT_SYMBOL_GPL(clk_restore_context);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment