提交 d6347445 编写于 作者: Y Yisheng Xie 提交者: Stephen Boyd

clk: use match_string() helper

match_string() returns the index of an array for a matching string,
which can be used instead of open coded variant.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Signed-off-by: NYisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: NStephen Boyd <sboyd@kernel.org>
上级 99e71543
...@@ -2170,7 +2170,6 @@ void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent) ...@@ -2170,7 +2170,6 @@ void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent)
bool clk_has_parent(struct clk *clk, struct clk *parent) bool clk_has_parent(struct clk *clk, struct clk *parent)
{ {
struct clk_core *core, *parent_core; struct clk_core *core, *parent_core;
unsigned int i;
/* NULL clocks should be nops, so return success if either is NULL. */ /* NULL clocks should be nops, so return success if either is NULL. */
if (!clk || !parent) if (!clk || !parent)
...@@ -2183,11 +2182,8 @@ bool clk_has_parent(struct clk *clk, struct clk *parent) ...@@ -2183,11 +2182,8 @@ bool clk_has_parent(struct clk *clk, struct clk *parent)
if (core->parent == parent_core) if (core->parent == parent_core)
return true; return true;
for (i = 0; i < core->num_parents; i++) return match_string(core->parent_names, core->num_parents,
if (strcmp(core->parent_names[i], parent_core->name) == 0) parent_core->name) >= 0;
return true;
return false;
} }
EXPORT_SYMBOL_GPL(clk_has_parent); EXPORT_SYMBOL_GPL(clk_has_parent);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册