Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 470b5e2f authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Stephen Boyd
Browse files

clk: simplify clk_fetch_parent_index() function



The clk_core_get_parent_by_index can be used as a helper function
to simplify the implementation of clk_fetch_parent_index().

Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 508f884a
Loading
Loading
Loading
Loading
+2 −16
Original line number Original line Diff line number Diff line
@@ -1069,23 +1069,9 @@ static int clk_fetch_parent_index(struct clk_core *core,
	if (!parent)
	if (!parent)
		return -EINVAL;
		return -EINVAL;


	/*
	for (i = 0; i < core->num_parents; i++)
	 * find index of new parent clock using cached parent ptrs,
		if (clk_core_get_parent_by_index(core, i) == parent)
	 * or if not yet cached, use string name comparison and cache
	 * them now to avoid future calls to clk_core_lookup.
	 */
	for (i = 0; i < core->num_parents; i++) {
		if (core->parents[i] == parent)
			return i;

		if (core->parents[i])
			continue;

		if (!strcmp(core->parent_names[i], parent->name)) {
			core->parents[i] = clk_core_lookup(parent->name);
			return i;
			return i;
		}
	}


	return -EINVAL;
	return -EINVAL;
}
}