[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1526903890-35761-10-git-send-email-xieyisheng1@huawei.com>
Date: Mon, 21 May 2018 19:57:46 +0800
From: Yisheng Xie <xieyisheng1@...wei.com>
To: <linux-kernel@...r.kernel.org>
CC: Yisheng Xie <xieyisheng1@...wei.com>,
Kishon Vijay Abraham I <kishon@...com>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>
Subject: [PATCH 09/33] phy: tegra: use match_string() helper
match_string() returns the index of an array for a matching string,
which can be used intead of open coded variant.
Cc: Kishon Vijay Abraham I <kishon@...com>
Cc: Thierry Reding <thierry.reding@...il.com>
Cc: Jonathan Hunter <jonathanh@...dia.com>
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Yisheng Xie <xieyisheng1@...wei.com>
---
drivers/phy/tegra/xusb.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index 11aa590..de1b4eb 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -102,19 +102,6 @@ static struct phy *tegra_xusb_pad_of_xlate(struct device *dev,
return np;
}
-static int
-tegra_xusb_lane_lookup_function(struct tegra_xusb_lane *lane,
- const char *function)
-{
- unsigned int i;
-
- for (i = 0; i < lane->soc->num_funcs; i++)
- if (strcmp(function, lane->soc->funcs[i]) == 0)
- return i;
-
- return -EINVAL;
-}
-
int tegra_xusb_lane_parse_dt(struct tegra_xusb_lane *lane,
struct device_node *np)
{
@@ -126,7 +113,7 @@ int tegra_xusb_lane_parse_dt(struct tegra_xusb_lane *lane,
if (err < 0)
return err;
- err = tegra_xusb_lane_lookup_function(lane, function);
+ err = match_string(lane->soc->funcs, lane->soc->num_funcs, function);
if (err < 0) {
dev_err(dev, "invalid function \"%s\" for lane \"%s\"\n",
function, np->name);
--
1.7.12.4
Powered by blists - more mailing lists