diff options
author | Xie Yisheng <xieyisheng1@huawei.com> | 2018-05-21 07:57:53 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2018-05-28 06:45:28 -0400 |
commit | e1cb88ad4655dd7484e56c01a05a2986496f56a8 (patch) | |
tree | 8fdfa1743342567352ae1be4ced629cb261e34b7 | |
parent | 8603f1e83897d3e4ed28c2c51ed6e8ef675908d9 (diff) |
mmc: sdhci-xenon: 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: Adrian Hunter <adrian.hunter@intel.com>
Cc: Hu Ziji <huziji@marvell.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/sdhci-xenon-phy.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/mmc/host/sdhci-xenon-phy.c b/drivers/mmc/host/sdhci-xenon-phy.c index ec8794335241..a35804b203a7 100644 --- a/drivers/mmc/host/sdhci-xenon-phy.c +++ b/drivers/mmc/host/sdhci-xenon-phy.c | |||
@@ -814,15 +814,10 @@ static int xenon_add_phy(struct device_node *np, struct sdhci_host *host, | |||
814 | { | 814 | { |
815 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | 815 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
816 | struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host); | 816 | struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host); |
817 | int i, ret; | 817 | int ret; |
818 | 818 | ||
819 | for (i = 0; i < NR_PHY_TYPES; i++) { | 819 | priv->phy_type = match_string(phy_types, NR_PHY_TYPES, phy_name); |
820 | if (!strcmp(phy_name, phy_types[i])) { | 820 | if (priv->phy_type < 0) { |
821 | priv->phy_type = i; | ||
822 | break; | ||
823 | } | ||
824 | } | ||
825 | if (i == NR_PHY_TYPES) { | ||
826 | dev_err(mmc_dev(host->mmc), | 821 | dev_err(mmc_dev(host->mmc), |
827 | "Unable to determine PHY name %s. Use default eMMC 5.1 PHY\n", | 822 | "Unable to determine PHY name %s. Use default eMMC 5.1 PHY\n", |
828 | phy_name); | 823 | phy_name); |