Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp589821imm; Mon, 21 May 2018 10:50:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrrlnFj/UYR9jP1hGNO9gp7ZeqpQ4KFkIUg1TjhLhrQquGudkim+MZMqUa09NweTyV9h1Ix X-Received: by 2002:a17:902:1007:: with SMTP id b7-v6mr20785213pla.88.1526925035391; Mon, 21 May 2018 10:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526925035; cv=none; d=google.com; s=arc-20160816; b=lig6b3wi+nSE3JEp8IJvIYnWN31NyFuR4KM5plHXlpxUSEZE9we83h2fYDTwJgJOfA cVV7pRtkZn+iF/tTFr5Y+N4COG84ZdNwVfBdXCHade4SA4wl9GStRIqskIp5dwdVpB2M qcIztu3bF8Bnha+mpsScXyfctkDq3LD/Q7FmZmCK0Bs8duI6GuPmzuvuhuVDi2Q+2Xh4 88kr03MmYDkzqtKtHXqu4FxHnqJiSPlt+pXhQECDd9A8hpESJ8rTieGCXGweBqdp7cfk G+AX9WABXIf0HO9Sl7578vkpQ0KF2PVLH8sRGykPoX5ty5SB8dGcYkjGHfaqAeDgxfT9 rzWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from :arc-authentication-results; bh=ivmKA/i/lB+Ix88poH4YMyNqN+XZpLeGY1upLGGmJcE=; b=AwCyBH9DfWwfJeqnB0VPfyuEvzZj+/bj5er/xqaV5m3ccSYLlYYmLXHokAw7oBIk9C 8X8dKQxPaJJx2uXrX8N4wtr83okLxqofQPJSw/8II4J85XII6gnm3sKNpYestkpIXk+p IYMhJyGa/TC9z4HiRqRlHgkW0SKSnw15DujO7tmM9cy/ORVJe66F6YDzNmmmlQ5FrEks OeS68XrHvfMoAiwm9em///XxDDcq8TWn4u85WGmuKzgxnsmIhvc/cG8ryn4UsU/kvfKX RwEILZLJG6O4pBtp+905fvtjn2jdPoTZQkmae4GbZM3cPAkbefTZXB1dG4wD1cdePVhc gtqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a92-v6si14640606pla.291.2018.05.21.10.50.19; Mon, 21 May 2018 10:50:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753323AbeEURtG (ORCPT + 99 others); Mon, 21 May 2018 13:49:06 -0400 Received: from anholt.net ([50.246.234.109]:49828 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753097AbeEURtC (ORCPT ); Mon, 21 May 2018 13:49:02 -0400 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id D89FB10A17B1; Mon, 21 May 2018 10:49:01 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xk8tqE7Mng7s; Mon, 21 May 2018 10:49:00 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 487B010A03B7; Mon, 21 May 2018 10:49:00 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 683A52FE2D94; Mon, 21 May 2018 18:48:59 +0100 (BST) From: Eric Anholt To: Yisheng Xie , linux-kernel@vger.kernel.org Cc: Yisheng Xie , Michael Turquette , Stephen Boyd , Stefan Wahren , 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 In-Reply-To: <1526903890-35761-13-git-send-email-xieyisheng1@huawei.com> References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> <1526903890-35761-13-git-send-email-xieyisheng1@huawei.com> User-Agent: Notmuch/0.22.2+1~gb0bcfaa (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Mon, 21 May 2018 10:48:58 -0700 Message-ID: <874lj0ew6t.fsf@anholt.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Yisheng Xie 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 > Cc: Stephen Boyd > Cc: Eric Anholt > Cc: Stefan Wahren > 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 > --- > 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; >=20=20 > /* > * Replace our strings referencing parent clocks with the > @@ -1405,12 +1404,11 @@ static struct clk_hw *bcm2835_register_clock(stru= ct bcm2835_cprman *cprman, > for (i =3D 0; i < data->num_mux_parents; i++) { > parents[i] =3D data->parents[i]; >=20=20 > - for (j =3D 0; j < ARRAY_SIZE(cprman_parent_names); j++) { > - if (strcmp(parents[i], cprman_parent_names[j]) =3D=3D 0) { > - parents[i] =3D cprman->real_parent_names[j]; > - break; > - } > - } > + ret =3D match_string(cprman_parent_names, > + ARRAY_SIZE(cprman_parent_names), > + parents[i]); > + if (ret >=3D 0) > + parents[i] =3D cprman->real_parent_names[ret]; Reviewed-by: Eric Anholt --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlsDBooACgkQtdYpNtH8 nug3LA//aZmSSf68qHXjBV33bop6na0WcGK0p+BArUD+EgndyLAliFCB+uEHQ0or RvMSkUcikTSaqurCLOBZpzOEYEDWtGTFY4HPgvqoKTbHm4+PKJfoCGdBgzb1BxJ6 ctLeglj8+YsBBluR4+1Dn0MJBNYaG7fifk9JeLNXE5PLkFkb1SYHtGqlkXyL0w/1 8jZM+WXmRjR637Xlxc7DReqx/x1pI03Ec5OAjkX4fX1a0inCr4Wm6hN9yEQlrZki 1XTZsPFW87+XZyUFwm6IBkGr4FsPglreeyjYAEdRTj+ymMJUJaY6BI1yj8v+H4I5 ZvLFJFXDuL7nbru0nMw/F5a1pewf5/UJMqDGH7AO3lBjnUMESQOtCjvaPbeIBpy8 jyYgwNfjwdSU8SaY99aMgr3WQcy9Uzlcof2Nmd2pgDOPBD3dJR1nSWQUbRX7v1Rw vrlYo0r0+cZZoUmoztj5bpaSOHf+mLpC4SBY6y+5PEL8FeHW9UoWZe5Zug3ZM1ZJ Eehp/9S+dMsEt5y8lphBNaKz40MGa2PpSrywEOeAowVKnxIj58borW1lK4r4riG+ GA84bDB904R/VUQetjdKxcAZvwN6k6VkEL9//M447m3WM+p4O/I7PfeDo9BhSqFf OS34GAVHTbp4GIV/Taq9MH0rEckYyr9FSPFy6jqMmLh1Fv2oNEw= =lr2s -----END PGP SIGNATURE----- --=-=-=--