All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yisheng Xie <xieyisheng1@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: Yisheng Xie <xieyisheng1@huawei.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Heiko Stuebner <heiko@sntech.de>,
	<linux-clk@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-rockchip@lists.infradead.org>
Subject: [PATCH 13/33] clk: rockchip: use match_string() helper
Date: Mon, 21 May 2018 19:57:50 +0800	[thread overview]
Message-ID: <1526903890-35761-14-git-send-email-xieyisheng1@huawei.com> (raw)
In-Reply-To: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com>

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: Heiko Stuebner <heiko@sntech.de>
Cc: linux-clk@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
---
 drivers/clk/rockchip/clk.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 3cd8ad5..514032d 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -274,18 +274,10 @@ static struct clk *rockchip_clk_register_frac_branch(
 		struct clk_mux *frac_mux = &frac->mux;
 		struct clk_init_data init;
 		struct clk *mux_clk;
-		int i, ret;
-
-		frac->mux_frac_idx = -1;
-		for (i = 0; i < child->num_parents; i++) {
-			if (!strcmp(name, child->parent_names[i])) {
-				pr_debug("%s: found fractional parent in mux at pos %d\n",
-					 __func__, i);
-				frac->mux_frac_idx = i;
-				break;
-			}
-		}
+		int ret;
 
+		frac->mux_frac_idx = match_string(child->parent_names,
+						  child->num_parents, name);
 		frac->mux_ops = &clk_mux_ops;
 		frac->clk_nb.notifier_call = rockchip_clk_frac_notifier_cb;
 
@@ -312,6 +304,8 @@ static struct clk *rockchip_clk_register_frac_branch(
 
 		/* notifier on the fraction divider to catch rate changes */
 		if (frac->mux_frac_idx >= 0) {
+			pr_debug("%s: find fractional parent in mux at pos %d\n",
+				 __func__, frac->mux_frac_idx);
 			ret = clk_notifier_register(clk, &frac->clk_nb);
 			if (ret)
 				pr_err("%s: failed to register clock notifier for %s\n",
-- 
1.7.12.4

WARNING: multiple messages have this Message-ID (diff)
From: Yisheng Xie <xieyisheng1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Yisheng Xie <xieyisheng1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>,
	Stephen Boyd <sboyd-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Michael Turquette
	<mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: [PATCH 13/33] clk: rockchip: use match_string() helper
Date: Mon, 21 May 2018 19:57:50 +0800	[thread overview]
Message-ID: <1526903890-35761-14-git-send-email-xieyisheng1@huawei.com> (raw)
In-Reply-To: <1526903890-35761-1-git-send-email-xieyisheng1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

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-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
Cc: Stephen Boyd <sboyd-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
Cc: linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Signed-off-by: Yisheng Xie <xieyisheng1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 drivers/clk/rockchip/clk.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 3cd8ad5..514032d 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -274,18 +274,10 @@ static struct clk *rockchip_clk_register_frac_branch(
 		struct clk_mux *frac_mux = &frac->mux;
 		struct clk_init_data init;
 		struct clk *mux_clk;
-		int i, ret;
-
-		frac->mux_frac_idx = -1;
-		for (i = 0; i < child->num_parents; i++) {
-			if (!strcmp(name, child->parent_names[i])) {
-				pr_debug("%s: found fractional parent in mux at pos %d\n",
-					 __func__, i);
-				frac->mux_frac_idx = i;
-				break;
-			}
-		}
+		int ret;
 
+		frac->mux_frac_idx = match_string(child->parent_names,
+						  child->num_parents, name);
 		frac->mux_ops = &clk_mux_ops;
 		frac->clk_nb.notifier_call = rockchip_clk_frac_notifier_cb;
 
@@ -312,6 +304,8 @@ static struct clk *rockchip_clk_register_frac_branch(
 
 		/* notifier on the fraction divider to catch rate changes */
 		if (frac->mux_frac_idx >= 0) {
+			pr_debug("%s: find fractional parent in mux at pos %d\n",
+				 __func__, frac->mux_frac_idx);
 			ret = clk_notifier_register(clk, &frac->clk_nb);
 			if (ret)
 				pr_err("%s: failed to register clock notifier for %s\n",
-- 
1.7.12.4

WARNING: multiple messages have this Message-ID (diff)
From: xieyisheng1@huawei.com (Yisheng Xie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 13/33] clk: rockchip: use match_string() helper
Date: Mon, 21 May 2018 19:57:50 +0800	[thread overview]
Message-ID: <1526903890-35761-14-git-send-email-xieyisheng1@huawei.com> (raw)
In-Reply-To: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com>

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: Heiko Stuebner <heiko@sntech.de>
Cc: linux-clk at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-rockchip at lists.infradead.org
Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
---
 drivers/clk/rockchip/clk.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 3cd8ad5..514032d 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -274,18 +274,10 @@ static struct clk *rockchip_clk_register_frac_branch(
 		struct clk_mux *frac_mux = &frac->mux;
 		struct clk_init_data init;
 		struct clk *mux_clk;
-		int i, ret;
-
-		frac->mux_frac_idx = -1;
-		for (i = 0; i < child->num_parents; i++) {
-			if (!strcmp(name, child->parent_names[i])) {
-				pr_debug("%s: found fractional parent in mux at pos %d\n",
-					 __func__, i);
-				frac->mux_frac_idx = i;
-				break;
-			}
-		}
+		int ret;
 
+		frac->mux_frac_idx = match_string(child->parent_names,
+						  child->num_parents, name);
 		frac->mux_ops = &clk_mux_ops;
 		frac->clk_nb.notifier_call = rockchip_clk_frac_notifier_cb;
 
@@ -312,6 +304,8 @@ static struct clk *rockchip_clk_register_frac_branch(
 
 		/* notifier on the fraction divider to catch rate changes */
 		if (frac->mux_frac_idx >= 0) {
+			pr_debug("%s: find fractional parent in mux at pos %d\n",
+				 __func__, frac->mux_frac_idx);
 			ret = clk_notifier_register(clk, &frac->clk_nb);
 			if (ret)
 				pr_err("%s: failed to register clock notifier for %s\n",
-- 
1.7.12.4

  parent reply	other threads:[~2018-05-21 12:14 UTC|newest]

Thread overview: 137+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 11:57 [PATCH 00/33] use match_string() helper Yisheng Xie
2018-05-21 11:57 ` [PATCH 01/33] usb: phy: " Yisheng Xie
2018-05-21 11:57   ` [01/33] " Xie Yisheng
2018-05-21 22:20   ` [PATCH 01/33] " Andy Shevchenko
2018-05-21 22:20     ` [01/33] " Andy Shevchenko
2018-05-22 10:02     ` [PATCH 01/33] " Greg Kroah-Hartman
2018-05-22 10:02       ` [01/33] " Greg Kroah-Hartman
2018-05-22 11:12       ` [PATCH 01/33] " Yisheng Xie
2018-05-22 11:12         ` [01/33] " Xie Yisheng
2018-05-21 11:57 ` [PATCH 02/33] mfd: omap-usb-host: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 17:41   ` Tony Lindgren
2018-06-04  6:15   ` Lee Jones
2018-05-21 11:57 ` [PATCH 03/33] Staging: gdm724x: " Yisheng Xie
2018-05-21 21:35   ` Andy Shevchenko
2018-05-21 11:57 ` [PATCH 04/33] gpiolib-of: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 21:36   ` Andy Shevchenko
2018-05-21 11:57 ` [PATCH 05/33] cxgb4: " Yisheng Xie
2018-05-21 21:39   ` Andy Shevchenko
2018-05-22  0:55     ` Yisheng Xie
2018-05-21 11:57 ` [PATCH 06/33] hp100: " Yisheng Xie
2018-05-21 11:57 ` [PATCH 07/33] iwlwifi: mvm: " Yisheng Xie
2018-05-21 20:12   ` Luca Coelho
2018-05-21 21:43   ` Andy Shevchenko
2018-05-22  3:30     ` Yisheng Xie
2018-05-22 20:41       ` Andy Shevchenko
2018-05-21 11:57 ` [PATCH 08/33] vfio: " Yisheng Xie
2018-05-25 20:55   ` Alex Williamson
2018-05-21 11:57 ` [PATCH 09/33] phy: tegra: " Yisheng Xie
2018-05-21 21:45   ` Andy Shevchenko
2018-05-21 11:57 ` [PATCH 10/33] pata_hpt37x: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 21:46   ` Andy Shevchenko
2018-05-21 11:57 ` [PATCH 11/33] bus: fsl-mc: " Yisheng Xie
2018-05-21 11:57 ` [PATCH 12/33] clk: bcm2835: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 17:48   ` Eric Anholt
2018-05-21 17:48     ` Eric Anholt
2018-05-21 21:50   ` Andy Shevchenko
2018-05-21 21:50     ` Andy Shevchenko
2018-05-22  3:42     ` Yisheng Xie
2018-05-22  3:42       ` Yisheng Xie
2018-05-21 11:57 ` Yisheng Xie [this message]
2018-05-21 11:57   ` [PATCH 13/33] clk: rockchip: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-22 13:56   ` Heiko Stuebner
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
2018-05-21 11:57 ` [PATCH 15/33] cpufreq: intel_pstate: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 11:57 ` [PATCH 16/33] mmc: sdhci-xenon: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-24  7:58   ` Adrian Hunter
2018-05-28 11:27   ` Ulf Hansson
2018-05-21 11:57 ` [PATCH 17/33] pinctrl: armada-37xx: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 21:55   ` Andy Shevchenko
2018-05-21 21:55     ` Andy Shevchenko
2018-05-21 11:57 ` [PATCH 18/33] power: supply: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 21:58   ` Andy Shevchenko
2018-05-22 16:16     ` Sebastian Reichel
2018-05-21 11:57 ` [PATCH 19/33] thermal: db8500: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 22:00   ` Andy Shevchenko
2018-05-23  7:47     ` Yisheng Xie
2018-06-05 16:14       ` Andy Shevchenko
2018-05-21 11:57 ` [PATCH 20/33] video: fbdev: pxafb: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 22:01   ` Andy Shevchenko
2018-05-21 22:01     ` Andy Shevchenko
2018-05-21 11:57 ` [PATCH 21/33] drm/nouveau: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 22:03   ` Andy Shevchenko
2018-05-21 22:03     ` Andy Shevchenko
2018-05-21 11:57 ` [PATCH 22/33] drm/i915: " Yisheng Xie
2018-05-21 11:57   ` Yisheng Xie
2018-05-21 22:04   ` Andy Shevchenko
2018-05-21 22:04     ` Andy Shevchenko
2018-05-22  8:36     ` Jani Nikula
2018-05-22  8:36       ` Jani Nikula
2018-05-22  9:22       ` Yisheng Xie
2018-05-22  9:22         ` Yisheng Xie
2018-05-21 11:58 ` [PATCH 23/33] drm: i2c: ch7006: " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-21 11:58 ` [PATCH 24/33] drm: " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-21 22:06   ` Andy Shevchenko
2018-05-21 22:06     ` Andy Shevchenko
2018-05-22  8:39     ` Jani Nikula
2018-05-22  8:39       ` Jani Nikula
2018-05-21 11:58 ` [PATCH 25/33] ima: " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-23 14:42   ` Mimi Zohar
2018-05-23 14:42     ` Mimi Zohar
2018-05-21 11:58 ` [PATCH 26/33] apparmor: " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-21 15:33   ` John Johansen
2018-05-21 15:33     ` John Johansen
2018-05-22  1:25     ` Yisheng Xie
2018-05-22  1:25       ` Yisheng Xie
2018-05-21 22:10   ` Andy Shevchenko
2018-05-21 22:10     ` Andy Shevchenko
2018-05-21 11:58 ` [PATCH 27/33] sched/debug: " Yisheng Xie
2018-05-21 22:13   ` Andy Shevchenko
2018-05-22 12:10     ` Yisheng Xie
2018-05-22 20:29       ` Andy Shevchenko
2018-05-21 11:58 ` [PATCH 28/33] ALSA: dice " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-21 22:31   ` Takashi Sakamoto
2018-05-21 11:58 ` [PATCH 29/33] ALSA: oxfw: " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-21 22:26   ` [alsa-devel] " Takashi Sakamoto
2018-05-22  7:26     ` Takashi Iwai
2018-05-22  7:26       ` Takashi Iwai
2018-05-21 11:58 ` [PATCH 30/33] ALSA: oxygen: " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-21 22:23   ` Andy Shevchenko
2018-05-21 11:58 ` [PATCH 31/33] ASoC: max98088: " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-21 22:24   ` Andy Shevchenko
2018-05-21 22:24     ` Andy Shevchenko
2018-05-22 12:30     ` Yisheng Xie
2018-05-22 17:23       ` Andy Shevchenko
2018-05-21 11:58 ` [PATCH 32/33] ASoC: max98095: " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-21 22:25   ` Andy Shevchenko
2018-05-21 22:25     ` Andy Shevchenko
2018-05-21 11:58 ` [PATCH 33/33] ASoC: dapm: " Yisheng Xie
2018-05-21 11:58   ` Yisheng Xie
2018-05-31 16:09   ` Applied "ASoC: dapm: use match_string() helper" to the asoc tree Mark Brown
2018-05-31 16:09     ` Mark Brown
2018-05-21 22:27 ` [PATCH 00/33] use match_string() helper Andy Shevchenko
2018-05-22  0:52   ` Yisheng Xie

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=1526903890-35761-14-git-send-email-xieyisheng1@huawei.com \
    --to=xieyisheng1@huawei.com \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.