Commit 768a5d4f authored by Stephen Boyd's avatar Stephen Boyd

clk: Use 'parent' to shorten lines in __clk_core_init()

Some lines are getting long in this function. Let's move 'parent' up to
the top of the function and use it in many places whenever there is a
parent for a clk. This shortens some lines by avoiding core->parent->
indirections.

Cc: Douglas Anderson <dianders@chromium.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
Link: https://lkml.kernel.org/r/20200205232802.29184-3-sboyd@kernel.orgAcked-by: default avatarJerome Brunet <jbrunet@baylibre.com>
parent f21cf9c7
...@@ -3342,6 +3342,7 @@ static void clk_core_reparent_orphans_nolock(void) ...@@ -3342,6 +3342,7 @@ static void clk_core_reparent_orphans_nolock(void)
static int __clk_core_init(struct clk_core *core) static int __clk_core_init(struct clk_core *core)
{ {
int ret; int ret;
struct clk_core *parent;
unsigned long rate; unsigned long rate;
if (!core) if (!core)
...@@ -3413,7 +3414,7 @@ static int __clk_core_init(struct clk_core *core) ...@@ -3413,7 +3414,7 @@ static int __clk_core_init(struct clk_core *core)
goto out; goto out;
} }
core->parent = __clk_init_parent(core); parent = core->parent = __clk_init_parent(core);
/* /*
* Populate core->parent if parent has already been clk_core_init'd. If * Populate core->parent if parent has already been clk_core_init'd. If
...@@ -3425,10 +3426,9 @@ static int __clk_core_init(struct clk_core *core) ...@@ -3425,10 +3426,9 @@ static int __clk_core_init(struct clk_core *core)
* clocks and re-parent any that are children of the clock currently * clocks and re-parent any that are children of the clock currently
* being clk_init'd. * being clk_init'd.
*/ */
if (core->parent) { if (parent) {
hlist_add_head(&core->child_node, hlist_add_head(&core->child_node, &parent->children);
&core->parent->children); core->orphan = parent->orphan;
core->orphan = core->parent->orphan;
} else if (!core->num_parents) { } else if (!core->num_parents) {
hlist_add_head(&core->child_node, &clk_root_list); hlist_add_head(&core->child_node, &clk_root_list);
core->orphan = false; core->orphan = false;
...@@ -3446,9 +3446,9 @@ static int __clk_core_init(struct clk_core *core) ...@@ -3446,9 +3446,9 @@ static int __clk_core_init(struct clk_core *core)
*/ */
if (core->ops->recalc_accuracy) if (core->ops->recalc_accuracy)
core->accuracy = core->ops->recalc_accuracy(core->hw, core->accuracy = core->ops->recalc_accuracy(core->hw,
__clk_get_accuracy(core->parent)); __clk_get_accuracy(parent));
else if (core->parent) else if (parent)
core->accuracy = core->parent->accuracy; core->accuracy = parent->accuracy;
else else
core->accuracy = 0; core->accuracy = 0;
...@@ -3472,9 +3472,9 @@ static int __clk_core_init(struct clk_core *core) ...@@ -3472,9 +3472,9 @@ static int __clk_core_init(struct clk_core *core)
*/ */
if (core->ops->recalc_rate) if (core->ops->recalc_rate)
rate = core->ops->recalc_rate(core->hw, rate = core->ops->recalc_rate(core->hw,
clk_core_get_rate_nolock(core->parent)); clk_core_get_rate_nolock(parent));
else if (core->parent) else if (parent)
rate = core->parent->rate; rate = parent->rate;
else else
rate = 0; rate = 0;
core->rate = core->req_rate = rate; core->rate = core->req_rate = rate;
......
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