Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp232341imm; Mon, 21 May 2018 05:18:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrBn83Da5/EacKTW2CyBl+nvDpzmM9g/CbrURQe5zmTtR/xDCuI1bocyT3yJEg3WjHzw/IK X-Received: by 2002:a62:32c6:: with SMTP id y189-v6mr19776640pfy.241.1526905081858; Mon, 21 May 2018 05:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526905081; cv=none; d=google.com; s=arc-20160816; b=0RNV3B71/kwKBh47nL4vqoJ/4WVdhiH7n4KIlvU9N4IqN4JRZ+6Qk8kVkI7KoYM9dh uCTLYJjFhJIjXU/ObvI/4QbFrMAffTRgr8OCJyczBIjNBgu0ExSMKdgxe/hw4GA0+E38 0qrHYX8GzrJKbQMXU4msAs6MB2IBXLYUotWIg8CWWTNYEddMMrtKDX3uuoqwtKTfqyZ+ pANyMeYcTtL/1SjZ+UDGIHQY7/apcED2uorBgWgBknfv7BRrp0murohjLXngJNhypLd6 28vkTwNas1TfJLSJTAW7JdJXmR/54o76zwGvoSOdWeKUaTgGFh4G7vwBB7rPZ1eKV9ea 6JFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=y/4s/nNa6yCP2Aav/etXcrOV36DKpae5jUL6aTwtdqM=; b=lkBagCL+fXkVGbLlOWkXoUVp6IzLRLC8/8Kp/bvTPNqE4O7K3mH9h1YtlE7mAPDxaI WIG+LlHXJjHGsVd5u8oTCfwbiLJxt/BoWx1ZmQ7dYX8RouE3fCHcugF/NsfrMuUd42Rk 4m9ufumrEYt+pqENRynLBmP/Cuvq0YvkYZ8KJ07cEgC/Bsk24sUY9Ui7ytedy3egEkru EvswChJnZUxUaDWyfkItavz4oyodYPuUkhv2ZLbd9u9Rw8g21P6Ma39nLeYt+AIIbrCt XqAuOsiLHBrZgEekbp3vq8lKLKm4VZ3dpW/PB7SixaV4fJ9UvCCPdsNQVVPb7WjXGy6w L6/Q== 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 r26-v6si6585023pgn.373.2018.05.21.05.17.47; Mon, 21 May 2018 05:18:01 -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 S1752753AbeEUMPv (ORCPT + 99 others); Mon, 21 May 2018 08:15:51 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:38664 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751514AbeEUMJE (ORCPT ); Mon, 21 May 2018 08:09:04 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 0904E3CB77B11; Mon, 21 May 2018 20:09:01 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Mon, 21 May 2018 20:08:56 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Adrian Hunter , Hu Ziji , Ulf Hansson , Subject: [PATCH 16/33] mmc: sdhci-xenon: use match_string() helper Date: Mon, 21 May 2018 19:57:53 +0800 Message-ID: <1526903890-35761-17-git-send-email-xieyisheng1@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org match_string() returns the index of an array for a matching string, which can be used intead of open coded variant. Cc: Adrian Hunter Cc: Hu Ziji Cc: Ulf Hansson Cc: linux-mmc@vger.kernel.org Signed-off-by: Yisheng Xie --- drivers/mmc/host/sdhci-xenon-phy.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sdhci-xenon-phy.c b/drivers/mmc/host/sdhci-xenon-phy.c index ec87943..a35804b 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, { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host); - int i, ret; + int ret; - for (i = 0; i < NR_PHY_TYPES; i++) { - if (!strcmp(phy_name, phy_types[i])) { - priv->phy_type = i; - break; - } - } - if (i == NR_PHY_TYPES) { + priv->phy_type = match_string(phy_types, NR_PHY_TYPES, phy_name); + if (priv->phy_type < 0) { dev_err(mmc_dev(host->mmc), "Unable to determine PHY name %s. Use default eMMC 5.1 PHY\n", phy_name); -- 1.7.12.4