Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp231592imm; Mon, 21 May 2018 05:17:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZracmqQcJnRFC5Gu+2sl2ijJD7PhQXXVtDLCNXrVCi/NGh6PCLIpnKoBFHuXofQgREegWY7 X-Received: by 2002:a65:46ce:: with SMTP id n14-v6mr1075617pgr.193.1526905035907; Mon, 21 May 2018 05:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526905035; cv=none; d=google.com; s=arc-20160816; b=Ug/1MuGj5LPB0nHPH8D3vjW8FpYj4ssbLeRYX+4Oh3i4nwbpJIImtEUeWg6tiMycmQ 98Q8bb85Oa9R0Ozuy1di0qUdTUUKNFhDfEIcro6+5pgZSp5XpuYdCqdsAf5HbPDU+QOW r8hIG+zZpvnQeaMZYN+h6k6+9PnSdLxjELbFbFY8riU2ym/llnY6MGvcAvOCxGKoSkdf Ld6+grt6+M9ws4qIVhIVCtxjQDrXqrEtY+qpJ5gLMiwEU145nLVdfaLDkvjgsXU55m/k U7bmsLS7ApThKbNiJwd8CvWR/wpULKrtG6k8D0NM8fS1ASB0snRYOVMAnuqDYv1d0rlw gt5g== 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=r+KfhVpFfyzwedIZ60hQNs/4ktaHt74tptDLDYETLUI=; b=Ved1jL4onkkmWSvyiAROBN8p6fQFOwYmCmwx9QL2N1yEqdmz9/lw10rkoXH6p1Qp36 Li/At735K3hgRr7bQGprVVehfUA5/J3h/Qeuzz7Lu+0K01XX86gTEnvh6PhcfdW4IHhm jJb+LseRaDh22dYdDMORPLUKgNd5f3ko/8v5rUyUfHxLvnHQtckM1aOBQa7gmQOxXGMe Ea8BcGYIrpDE9ITgKy7L1cY4a72cXLncSVyZDLPdIchu3AtS6GTa7rHyURpjbiczAbC3 tXG7wtHZ4aGOPz8pEpZKdsJTjGsr8IA+ezI/Xk+f4/LByxV4+lsrt7nM9aRv6fK1posR Op3Q== 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 k17-v6si13964339pfj.310.2018.05.21.05.17.01; Mon, 21 May 2018 05:17:15 -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 S1753053AbeEUMO5 (ORCPT + 99 others); Mon, 21 May 2018 08:14:57 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:38697 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752633AbeEUMJF (ORCPT ); Mon, 21 May 2018 08:09:05 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 25DCDDFC05F5; 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:52 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Kishon Vijay Abraham I , Thierry Reding , Jonathan Hunter Subject: [PATCH 09/33] phy: tegra: use match_string() helper Date: Mon, 21 May 2018 19:57:46 +0800 Message-ID: <1526903890-35761-10-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: Kishon Vijay Abraham I Cc: Thierry Reding Cc: Jonathan Hunter Cc: linux-kernel@vger.kernel.org Signed-off-by: Yisheng Xie --- 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