From: Eric Anholt <eric@anholt.net>
To: Yisheng Xie <xieyisheng1@huawei.com>, linux-kernel@vger.kernel.org
Cc: Yisheng Xie <xieyisheng1@huawei.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Stefan Wahren <stefan.wahren@i2se.com>,
linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 12/33] clk: bcm2835: use match_string() helper
Date: Mon, 21 May 2018 10:48:58 -0700 [thread overview]
Message-ID: <874lj0ew6t.fsf@anholt.net> (raw)
In-Reply-To: <1526903890-35761-13-git-send-email-xieyisheng1@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 1798 bytes --]
Yisheng Xie <xieyisheng1@huawei.com> writes:
> 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: 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: Yisheng Xie <xieyisheng1@huawei.com>
> ---
> drivers/clk/bcm/clk-bcm2835.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
> index fa0d5c8..a27c0d2 100644
> --- a/drivers/clk/bcm/clk-bcm2835.c
> +++ b/drivers/clk/bcm/clk-bcm2835.c
> @@ -1395,8 +1395,7 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
> struct bcm2835_clock *clock;
> struct clk_init_data init;
> const char *parents[1 << CM_SRC_BITS];
> - size_t i, j;
> - int ret;
> + int i, ret;
>
> /*
> * Replace our strings referencing parent clocks with the
> @@ -1405,12 +1404,11 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
> for (i = 0; i < data->num_mux_parents; i++) {
> parents[i] = data->parents[i];
>
> - for (j = 0; j < ARRAY_SIZE(cprman_parent_names); j++) {
> - if (strcmp(parents[i], cprman_parent_names[j]) == 0) {
> - parents[i] = cprman->real_parent_names[j];
> - break;
> - }
> - }
> + ret = match_string(cprman_parent_names,
> + ARRAY_SIZE(cprman_parent_names),
> + parents[i]);
> + if (ret >= 0)
> + parents[i] = cprman->real_parent_names[ret];
Reviewed-by: Eric Anholt <eric@anholt.net>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2018-05-21 17:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com>
2018-05-21 11:57 ` [PATCH 12/33] clk: bcm2835: use match_string() helper Yisheng Xie
2018-05-21 17:48 ` Eric Anholt [this message]
2018-05-21 21:50 ` Andy Shevchenko
2018-05-22 3:42 ` Yisheng Xie
2018-05-21 11:57 ` [PATCH 13/33] clk: rockchip: " Yisheng Xie
2018-05-22 13:56 ` Heiko Stuebner
2018-05-21 11:57 ` [PATCH 14/33] clk: " Yisheng Xie
2018-05-21 21:53 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874lj0ew6t.fsf@anholt.net \
--to=eric@anholt.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=stefan.wahren@i2se.com \
--cc=xieyisheng1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox