diff options
author | Stephen Boyd <sboyd@kernel.org> | 2018-10-11 12:28:13 -0400 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2018-10-11 12:28:13 -0400 |
commit | 9be766274db4c446e54bc0c2f0c1fbcbb4a2bd1e (patch) | |
tree | b2c247893016401fee6e7caf243b7ca5907b455c | |
parent | 3d3062214367a8f8e623466d1eb78e82ee9751ef (diff) |
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>
-rw-r--r-- | drivers/clk/clk.c | 42 |
1 files changed, 22 insertions, 20 deletions
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) | |||
935 | */ | 935 | */ |
936 | void clk_gate_restore_context(struct clk_hw *hw) | 936 | void clk_gate_restore_context(struct clk_hw *hw) |
937 | { | 937 | { |
938 | if (hw->clk->core->enable_count) | 938 | struct clk_core *core = hw->core; |
939 | hw->clk->core->ops->enable(hw); | 939 | |
940 | if (core->enable_count) | ||
941 | core->ops->enable(hw); | ||
940 | else | 942 | else |
941 | hw->clk->core->ops->disable(hw); | 943 | core->ops->disable(hw); |
942 | } | 944 | } |
943 | EXPORT_SYMBOL_GPL(clk_gate_restore_context); | 945 | EXPORT_SYMBOL_GPL(clk_gate_restore_context); |
944 | 946 | ||
945 | static int _clk_save_context(struct clk_core *clk) | 947 | static int clk_core_save_context(struct clk_core *core) |
946 | { | 948 | { |
947 | struct clk_core *child; | 949 | struct clk_core *child; |
948 | int ret = 0; | 950 | int ret = 0; |
949 | 951 | ||
950 | hlist_for_each_entry(child, &clk->children, child_node) { | 952 | hlist_for_each_entry(child, &core->children, child_node) { |
951 | ret = _clk_save_context(child); | 953 | ret = clk_core_save_context(child); |
952 | if (ret < 0) | 954 | if (ret < 0) |
953 | return ret; | 955 | return ret; |
954 | } | 956 | } |
955 | 957 | ||
956 | if (clk->ops && clk->ops->save_context) | 958 | if (core->ops && core->ops->save_context) |
957 | ret = clk->ops->save_context(clk->hw); | 959 | ret = core->ops->save_context(core->hw); |
958 | 960 | ||
959 | return ret; | 961 | return ret; |
960 | } | 962 | } |
961 | 963 | ||
962 | static void _clk_restore_context(struct clk_core *clk) | 964 | static void clk_core_restore_context(struct clk_core *core) |
963 | { | 965 | { |
964 | struct clk_core *child; | 966 | struct clk_core *child; |
965 | 967 | ||
966 | if (clk->ops && clk->ops->restore_context) | 968 | if (core->ops && core->ops->restore_context) |
967 | clk->ops->restore_context(clk->hw); | 969 | core->ops->restore_context(core->hw); |
968 | 970 | ||
969 | hlist_for_each_entry(child, &clk->children, child_node) | 971 | hlist_for_each_entry(child, &core->children, child_node) |
970 | _clk_restore_context(child); | 972 | clk_core_restore_context(child); |
971 | } | 973 | } |
972 | 974 | ||
973 | /** | 975 | /** |
@@ -983,13 +985,13 @@ int clk_save_context(void) | |||
983 | int ret; | 985 | int ret; |
984 | 986 | ||
985 | hlist_for_each_entry(clk, &clk_root_list, child_node) { | 987 | hlist_for_each_entry(clk, &clk_root_list, child_node) { |
986 | ret = _clk_save_context(clk); | 988 | ret = clk_core_save_context(clk); |
987 | if (ret < 0) | 989 | if (ret < 0) |
988 | return ret; | 990 | return ret; |
989 | } | 991 | } |
990 | 992 | ||
991 | hlist_for_each_entry(clk, &clk_orphan_list, child_node) { | 993 | hlist_for_each_entry(clk, &clk_orphan_list, child_node) { |
992 | ret = _clk_save_context(clk); | 994 | ret = clk_core_save_context(clk); |
993 | if (ret < 0) | 995 | if (ret < 0) |
994 | return ret; | 996 | return ret; |
995 | } | 997 | } |
@@ -1006,13 +1008,13 @@ EXPORT_SYMBOL_GPL(clk_save_context); | |||
1006 | */ | 1008 | */ |
1007 | void clk_restore_context(void) | 1009 | void clk_restore_context(void) |
1008 | { | 1010 | { |
1009 | struct clk_core *clk; | 1011 | struct clk_core *core; |
1010 | 1012 | ||
1011 | hlist_for_each_entry(clk, &clk_root_list, child_node) | 1013 | hlist_for_each_entry(core, &clk_root_list, child_node) |
1012 | _clk_restore_context(clk); | 1014 | clk_core_restore_context(core); |
1013 | 1015 | ||
1014 | hlist_for_each_entry(clk, &clk_orphan_list, child_node) | 1016 | hlist_for_each_entry(core, &clk_orphan_list, child_node) |
1015 | _clk_restore_context(clk); | 1017 | clk_core_restore_context(core); |
1016 | } | 1018 | } |
1017 | EXPORT_SYMBOL_GPL(clk_restore_context); | 1019 | EXPORT_SYMBOL_GPL(clk_restore_context); |
1018 | 1020 | ||