summaryrefslogtreecommitdiff
path: root/drivers/clk
diff options
context:
space:
mode:
authorYisheng Xie <xieyisheng1@huawei.com>2018-05-31 14:11:14 +0300
committerStephen Boyd <sboyd@kernel.org>2018-06-02 09:17:08 +0300
commitd6347445c49637237c5316fd76833be1d0ffa695 (patch)
tree6bb85aca7c30e9b848cd6b482df2205b4c5f13de /drivers/clk
parent99e71543521ce1646fb8d3de1e68fe56a3ba5f8e (diff)
downloadlinux-d6347445c49637237c5316fd76833be1d0ffa695.tar.xz
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: Yisheng Xie <xieyisheng1@huawei.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index ea67ac81c6f9..b7d1a5634164 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -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)
{
struct clk_core *core, *parent_core;
- unsigned int i;
/* NULL clocks should be nops, so return success if either is NULL. */
if (!clk || !parent)
@@ -2183,11 +2182,8 @@ bool clk_has_parent(struct clk *clk, struct clk *parent)
if (core->parent == parent_core)
return true;
- for (i = 0; i < core->num_parents; i++)
- if (strcmp(core->parent_names[i], parent_core->name) == 0)
- return true;
-
- return false;
+ return match_string(core->parent_names, core->num_parents,
+ parent_core->name) >= 0;
}
EXPORT_SYMBOL_GPL(clk_has_parent);