Skip to content

Commit 9be7662

Browse files
committed
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: Stephen Boyd <sboyd@kernel.org>
1 parent 3d30622 commit 9be7662

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

drivers/clk/clk.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -935,39 +935,41 @@ static int clk_core_enable_lock(struct clk_core *core)
935935
*/
936936
void clk_gate_restore_context(struct clk_hw *hw)
937937
{
938-
if (hw->clk->core->enable_count)
939-
hw->clk->core->ops->enable(hw);
938+
struct clk_core *core = hw->core;
939+
940+
if (core->enable_count)
941+
core->ops->enable(hw);
940942
else
941-
hw->clk->core->ops->disable(hw);
943+
core->ops->disable(hw);
942944
}
943945
EXPORT_SYMBOL_GPL(clk_gate_restore_context);
944946

945-
static int _clk_save_context(struct clk_core *clk)
947+
static int clk_core_save_context(struct clk_core *core)
946948
{
947949
struct clk_core *child;
948950
int ret = 0;
949951

950-
hlist_for_each_entry(child, &clk->children, child_node) {
951-
ret = _clk_save_context(child);
952+
hlist_for_each_entry(child, &core->children, child_node) {
953+
ret = clk_core_save_context(child);
952954
if (ret < 0)
953955
return ret;
954956
}
955957

956-
if (clk->ops && clk->ops->save_context)
957-
ret = clk->ops->save_context(clk->hw);
958+
if (core->ops && core->ops->save_context)
959+
ret = core->ops->save_context(core->hw);
958960

959961
return ret;
960962
}
961963

962-
static void _clk_restore_context(struct clk_core *clk)
964+
static void clk_core_restore_context(struct clk_core *core)
963965
{
964966
struct clk_core *child;
965967

966-
if (clk->ops && clk->ops->restore_context)
967-
clk->ops->restore_context(clk->hw);
968+
if (core->ops && core->ops->restore_context)
969+
core->ops->restore_context(core->hw);
968970

969-
hlist_for_each_entry(child, &clk->children, child_node)
970-
_clk_restore_context(child);
971+
hlist_for_each_entry(child, &core->children, child_node)
972+
clk_core_restore_context(child);
971973
}
972974

973975
/**
@@ -983,13 +985,13 @@ int clk_save_context(void)
983985
int ret;
984986

985987
hlist_for_each_entry(clk, &clk_root_list, child_node) {
986-
ret = _clk_save_context(clk);
988+
ret = clk_core_save_context(clk);
987989
if (ret < 0)
988990
return ret;
989991
}
990992

991993
hlist_for_each_entry(clk, &clk_orphan_list, child_node) {
992-
ret = _clk_save_context(clk);
994+
ret = clk_core_save_context(clk);
993995
if (ret < 0)
994996
return ret;
995997
}
@@ -1006,13 +1008,13 @@ EXPORT_SYMBOL_GPL(clk_save_context);
10061008
*/
10071009
void clk_restore_context(void)
10081010
{
1009-
struct clk_core *clk;
1011+
struct clk_core *core;
10101012

1011-
hlist_for_each_entry(clk, &clk_root_list, child_node)
1012-
_clk_restore_context(clk);
1013+
hlist_for_each_entry(core, &clk_root_list, child_node)
1014+
clk_core_restore_context(core);
10131015

1014-
hlist_for_each_entry(clk, &clk_orphan_list, child_node)
1015-
_clk_restore_context(clk);
1016+
hlist_for_each_entry(core, &clk_orphan_list, child_node)
1017+
clk_core_restore_context(core);
10161018
}
10171019
EXPORT_SYMBOL_GPL(clk_restore_context);
10181020

0 commit comments

Comments
 (0)