Commit 99e71543 authored by Yisheng Xie's avatar Yisheng Xie Committed by Stephen Boyd

clk: bcm2835: 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.
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: linux-clk@vger.kernel.org
Cc: linux-rpi-kernel@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: default avatarYisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 60cc43fc
...@@ -1395,7 +1395,7 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, ...@@ -1395,7 +1395,7 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
struct bcm2835_clock *clock; struct bcm2835_clock *clock;
struct clk_init_data init; struct clk_init_data init;
const char *parents[1 << CM_SRC_BITS]; const char *parents[1 << CM_SRC_BITS];
size_t i, j; size_t i;
int ret; int ret;
/* /*
...@@ -1405,12 +1405,11 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, ...@@ -1405,12 +1405,11 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
for (i = 0; i < data->num_mux_parents; i++) { for (i = 0; i < data->num_mux_parents; i++) {
parents[i] = data->parents[i]; parents[i] = data->parents[i];
for (j = 0; j < ARRAY_SIZE(cprman_parent_names); j++) { ret = match_string(cprman_parent_names,
if (strcmp(parents[i], cprman_parent_names[j]) == 0) { ARRAY_SIZE(cprman_parent_names),
parents[i] = cprman->real_parent_names[j]; parents[i]);
break; if (ret >= 0)
} parents[i] = cprman->real_parent_names[ret];
}
} }
memset(&init, 0, sizeof(init)); memset(&init, 0, sizeof(init));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment