Skip to content

Commit 768a5d4

Browse files
committed
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 <[email protected]> Cc: Heiko Stuebner <[email protected]> Cc: Jerome Brunet <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Acked-by: Jerome Brunet <[email protected]>
1 parent f21cf9c commit 768a5d4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/clk/clk.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3342,6 +3342,7 @@ static void clk_core_reparent_orphans_nolock(void)
33423342
static int __clk_core_init(struct clk_core *core)
33433343
{
33443344
int ret;
3345+
struct clk_core *parent;
33453346
unsigned long rate;
33463347

33473348
if (!core)
@@ -3413,7 +3414,7 @@ static int __clk_core_init(struct clk_core *core)
34133414
goto out;
34143415
}
34153416

3416-
core->parent = __clk_init_parent(core);
3417+
parent = core->parent = __clk_init_parent(core);
34173418

34183419
/*
34193420
* 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)
34253426
* clocks and re-parent any that are children of the clock currently
34263427
* being clk_init'd.
34273428
*/
3428-
if (core->parent) {
3429-
hlist_add_head(&core->child_node,
3430-
&core->parent->children);
3431-
core->orphan = core->parent->orphan;
3429+
if (parent) {
3430+
hlist_add_head(&core->child_node, &parent->children);
3431+
core->orphan = parent->orphan;
34323432
} else if (!core->num_parents) {
34333433
hlist_add_head(&core->child_node, &clk_root_list);
34343434
core->orphan = false;
@@ -3446,9 +3446,9 @@ static int __clk_core_init(struct clk_core *core)
34463446
*/
34473447
if (core->ops->recalc_accuracy)
34483448
core->accuracy = core->ops->recalc_accuracy(core->hw,
3449-
__clk_get_accuracy(core->parent));
3450-
else if (core->parent)
3451-
core->accuracy = core->parent->accuracy;
3449+
__clk_get_accuracy(parent));
3450+
else if (parent)
3451+
core->accuracy = parent->accuracy;
34523452
else
34533453
core->accuracy = 0;
34543454

@@ -3472,9 +3472,9 @@ static int __clk_core_init(struct clk_core *core)
34723472
*/
34733473
if (core->ops->recalc_rate)
34743474
rate = core->ops->recalc_rate(core->hw,
3475-
clk_core_get_rate_nolock(core->parent));
3476-
else if (core->parent)
3477-
rate = core->parent->rate;
3475+
clk_core_get_rate_nolock(parent));
3476+
else if (parent)
3477+
rate = parent->rate;
34783478
else
34793479
rate = 0;
34803480
core->rate = core->req_rate = rate;

0 commit comments

Comments
 (0)