Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp231257imm; Mon, 21 May 2018 05:16:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrl79tXVXYTY2jKwZuqSgTLcwj1MMaUlnHTbmSjuLOwunx1XL4WXY7NIvbz4b7HxRYyqDXI X-Received: by 2002:a17:902:710f:: with SMTP id a15-v6mr20613678pll.171.1526905014250; Mon, 21 May 2018 05:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526905014; cv=none; d=google.com; s=arc-20160816; b=whaLZIuDPnUtlQoB3Zf+17sIxOnN12oATzyQpitGcypI8QVARrErR+Q1yzLdIXVJ/Z A2S2/uE1G6Gfzz++2fnKIAa7s5n6vVlBH88JI/7jgir3w/3hilC4UaUwKh9Cr3OJkFes DcVX0rgYAKgir6pghYjMyPmF8HitMk4Zph5PK8aDKuv9k2PHUKiXHiWY+4aqXEqalXl6 4xCTF9L+/GUETvFk9rTys8W3oMK6qCBWvHwJbiBuwPcwlht1VbNaPUmmQO9wqa/riGNr Ns5a3qQUiR2xpq6bmdw/FI1diMM15l9WualsTzZ0VbZkj2BGrCyDUzprGu5E/vkP9wu/ uuvQ== 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=ctbcz5ZInlTFVmNfnxG58NNz8BmGabR/wvnmsupOrwA=; b=jcXhGTKm2QLR7WB8hK+QR9D6tdd1WEOMP80/afPU373Zqh4CdyILH4fCXRs96n6Y4B 2Rv5ZFaxSSZFtdHrQW5iE2IDnOK17z85VxsIVY2uWGsfHZ4BuJWmaCFaJyqUwk4ECELr 5Zq/59Zk8yCb4M5VayQYNpar9wCCPt+k8PERTZ14epLWa0lzMHl/th6TI5El0j9bpGBw onrEiOl5VWlPa1ewikZ+wxGY7/3NosP19BqT3o6gaMxq0oC5InzzVCwloR0eEC7V6zFp a6KMy0khcHhQMNlAbxUoocfAERhnlbjXrCfaaTvQznJiRt4mAcw9IgHsJLK+JDVq612x Zd7w== 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 h193-v6si11077607pgc.57.2018.05.21.05.16.39; Mon, 21 May 2018 05:16:54 -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 S1752974AbeEUMOu (ORCPT + 99 others); Mon, 21 May 2018 08:14:50 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:38741 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751075AbeEUMJG (ORCPT ); Mon, 21 May 2018 08:09:06 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 52A7D2BFC0D78; 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 , Jason Cooper , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Linus Walleij , , Subject: [PATCH 17/33] pinctrl: armada-37xx: use match_string() helper Date: Mon, 21 May 2018 19:57:54 +0800 Message-ID: <1526903890-35761-18-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: Jason Cooper Cc: Andrew Lunn Cc: Gregory Clement Cc: Sebastian Hesselbarth Cc: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org Cc: linux-gpio@vger.kernel.org Signed-off-by: Yisheng Xie --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 5b63248..e338327 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -214,18 +214,6 @@ static inline void armada_37xx_update_reg(unsigned int *reg, } } -static int armada_37xx_get_func_reg(struct armada_37xx_pin_group *grp, - const char *func) -{ - int f; - - for (f = 0; (f < NB_FUNCS) && grp->funcs[f]; f++) - if (!strcmp(grp->funcs[f], func)) - return f; - - return -ENOTSUPP; -} - static struct armada_37xx_pin_group *armada_37xx_find_next_grp_by_pin( struct armada_37xx_pinctrl *info, int pin, int *grp) { @@ -344,10 +332,10 @@ static int armada_37xx_pmx_set_by_name(struct pinctrl_dev *pctldev, dev_dbg(info->dev, "enable function %s group %s\n", name, grp->name); - func = armada_37xx_get_func_reg(grp, name); + func = match_string(grp->funcs, NB_FUNCS, name); if (func < 0) - return func; + return -ENOTSUPP; val = grp->val[func]; -- 1.7.12.4