clk: rockchip: use match_string() helper
match_string() returns the index of an array for a matching string, which can be used intead of open coded variant. Cc: Michael Turquette <mturquette@baylibre.com> Cc: Stephen Boyd <sboyd@kernel.org> Cc: Heiko Stuebner <heiko@sntech.de> Cc: linux-clk@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
This commit is contained in:
parent
60cc43fc88
commit
a425702f68
|
@ -274,18 +274,10 @@ static struct clk *rockchip_clk_register_frac_branch(
|
||||||
struct clk_mux *frac_mux = &frac->mux;
|
struct clk_mux *frac_mux = &frac->mux;
|
||||||
struct clk_init_data init;
|
struct clk_init_data init;
|
||||||
struct clk *mux_clk;
|
struct clk *mux_clk;
|
||||||
int i, ret;
|
int ret;
|
||||||
|
|
||||||
frac->mux_frac_idx = -1;
|
|
||||||
for (i = 0; i < child->num_parents; i++) {
|
|
||||||
if (!strcmp(name, child->parent_names[i])) {
|
|
||||||
pr_debug("%s: found fractional parent in mux at pos %d\n",
|
|
||||||
__func__, i);
|
|
||||||
frac->mux_frac_idx = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
frac->mux_frac_idx = match_string(child->parent_names,
|
||||||
|
child->num_parents, name);
|
||||||
frac->mux_ops = &clk_mux_ops;
|
frac->mux_ops = &clk_mux_ops;
|
||||||
frac->clk_nb.notifier_call = rockchip_clk_frac_notifier_cb;
|
frac->clk_nb.notifier_call = rockchip_clk_frac_notifier_cb;
|
||||||
|
|
||||||
|
@ -312,6 +304,8 @@ static struct clk *rockchip_clk_register_frac_branch(
|
||||||
|
|
||||||
/* notifier on the fraction divider to catch rate changes */
|
/* notifier on the fraction divider to catch rate changes */
|
||||||
if (frac->mux_frac_idx >= 0) {
|
if (frac->mux_frac_idx >= 0) {
|
||||||
|
pr_debug("%s: found fractional parent in mux at pos %d\n",
|
||||||
|
__func__, frac->mux_frac_idx);
|
||||||
ret = clk_notifier_register(clk, &frac->clk_nb);
|
ret = clk_notifier_register(clk, &frac->clk_nb);
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_err("%s: failed to register clock notifier for %s\n",
|
pr_err("%s: failed to register clock notifier for %s\n",
|
||||||
|
|
Loading…
Reference in New Issue