Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1822549imm; Thu, 24 May 2018 01:11:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoxKtGmCo8+wP3mmfVvDQ1GXrlXFL8kDFjO0MzuX9nKEMAWySQuIbSP3zMejsVT97oVu2e4 X-Received: by 2002:a17:902:2f43:: with SMTP id s61-v6mr6144951plb.99.1527149499154; Thu, 24 May 2018 01:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527149499; cv=none; d=google.com; s=arc-20160816; b=wiyNlSZdmgNvFredsyR3JvK43o7W15C35/fijfb2WDZWnTFZToyV3Y9mfifr3ufI5J 4WYr7lFqvo3OkowP1ade6dZ3D5d8PRHGN8lnXeyVtMtLiR8QVDKIzRo71B9o5YBJa5kP FJrEgSrRXzgud5PXYRKVe889I7UQb1cS6LrbIqrOTCaSa8GJ5vKbzDCPiWbzcDWezyJr VI1jz2Iu9n9Jt2DW5rv9p7gxdraMhicRlNZYG+9j4Nnc+7/ZSSY0cFzBAuq/0gZ+I/Zb MgvvfilnIcLY6EmZ3zbbN/6lju2nEHZI+yo99dEph3YcC/DUgRitnhiAcHjNl23iETXR oYiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=zz9WT4LvqBXNnVgigjU1IcMoVcxwHpu7qqkOMoQ2b7U=; b=VV13+e+2EiBEGSBo3VX9N5sHt7aCIiqFw/o5no5TW67owYv6XHJji0IC+rA/nVCXbB b/4Se/qp2W3mK62CMrmK2gTtl4G4a5VhwB85y3n4WG3tjdpMIPUOeSsjZm2KAHW3z88j WqFEnuu7kVsYQsu3043eE6aohBIoNJWRyDBs4uDTRFbDIvhOMNYEr97sVjnClEtOMOLb THvd3Tgw3ksXimMNyaU+ygdRq4q8EzawSU4aN15UhtdGivr7wxFkCLRo8oGSPAcxypjC xcIUpgN+SI7mrMKC074Andv7BKiAisyCDnAsk1h/5IQju2T0WRYY5GOJ2r1Zv9kyqogj v3fg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2-v6si16041924pgc.438.2018.05.24.01.10.52; Thu, 24 May 2018 01:11:39 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935734AbeEXH77 (ORCPT + 99 others); Thu, 24 May 2018 03:59:59 -0400 Received: from mga01.intel.com ([192.55.52.88]:55846 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935508AbeEXH75 (ORCPT ); Thu, 24 May 2018 03:59:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2018 00:59:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,436,1520924400"; d="scan'208";a="58068780" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.168]) ([10.237.72.168]) by fmsmga001.fm.intel.com with ESMTP; 24 May 2018 00:59:55 -0700 Subject: Re: [PATCH 16/33] mmc: sdhci-xenon: use match_string() helper To: Yisheng Xie , linux-kernel@vger.kernel.org Cc: Hu Ziji , Ulf Hansson , linux-mmc@vger.kernel.org References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> <1526903890-35761-17-git-send-email-xieyisheng1@huawei.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <91fa698a-5e9f-d5ef-c50e-eada27db7c04@intel.com> Date: Thu, 24 May 2018 10:58:42 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1526903890-35761-17-git-send-email-xieyisheng1@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/05/18 14:57, Yisheng Xie wrote: > 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 Acked-by: Adrian Hunter > --- > 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); >