Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp228256imm; Mon, 21 May 2018 05:13:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrdcEyWjJxeZeH5jLDuAlMsrzK0eomCpxvjMBycotq0xlc8JJf2HScYOiMjWO6ptfTviqbJ X-Received: by 2002:a65:5b8a:: with SMTP id i10-v6mr11431102pgr.352.1526904831049; Mon, 21 May 2018 05:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526904831; cv=none; d=google.com; s=arc-20160816; b=qctfdhzYpzEz+zblowXeZBKMA5o1beTjxkz23jeuTV8Gjfwb3TgaR0xZdFJfJDtmod oRuSl6JRhRwh4Ts5nD+/Y0Q6o9L6LjFvYTxW4la6svail3fo/q/vIq0Cr46/oOwYxwNM JwAG1hcmO9NerDR9/+DVnmjlbFl1YyDVYU/khxUQVl56Q5nY+rHZe35PE1k7/EoZuGtd 53oO2pA3YPqi7SqhOQqrVB+6BrhJdCgBkTaTtNLwFiK3++lo70YTs4gdsJ00Abnq+xic x1Kyw+OHS1TgRvkFgWFbYAzr1tmvbbzSHJAyCtx7VDs7zTQlzkoCqnkToQiIMQyKX8/t XlnA== 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=dPV59uhwDt8sC16q1tGnEtxHWmOh70oH5CSNpO5ptfw=; b=l4PTO0JCAoWdGUUBLWH8y17EcyIRyWyk71OeGlC6ScZ1Z2I9F6xdcyXYIztXg9wdzp OKXWqOHld2TCVMbgoyK+fqbBp4kGNH2foD2IorLAuwWT6JHJVarenKcZN4oKX+R8W26l LNZtTCnJYiCUeSF2gWsZuljhUd2/OYKWYC7/Ul3/6UCa3SVgmLEsmetkebA7UWx81EwP 0Kprs+MK4bKUrgppHfWbq2UbHoY4Z9kvWBAJ7/Pz+gwZ1c+TxAwF+XMxHGAOzETYZR3x VHjeUuAZqwbqkHPPCFe6JlBdMCB3lBy5Xoi1m1tXvF7j8fpKqjaacgps6hDyF4gQxME1 h2Sw== 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 s64-v6si11000260pgb.113.2018.05.21.05.13.36; Mon, 21 May 2018 05:13:51 -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 S1753075AbeEUMLW (ORCPT + 99 others); Mon, 21 May 2018 08:11:22 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7725 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753027AbeEUMJ0 (ORCPT ); Mon, 21 May 2018 08:09:26 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 97E77A753BE51; Mon, 21 May 2018 20:09:11 +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:09:04 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Liam Girdwood , Mark Brown , Jaroslav Kysela , "Takashi Iwai" , Subject: [PATCH 31/33] ASoC: max98088: use match_string() helper Date: Mon, 21 May 2018 19:58:08 +0800 Message-ID: <1526903890-35761-32-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: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: alsa-devel@alsa-project.org Signed-off-by: Yisheng Xie --- sound/soc/codecs/max98088.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 865f64c..7383f90 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1382,14 +1382,11 @@ static int max98088_set_bias_level(struct snd_soc_component *component, static int max98088_get_channel(struct snd_soc_component *component, const char *name) { - int i; - - for (i = 0; i < ARRAY_SIZE(eq_mode_name); i++) - if (strcmp(name, eq_mode_name[i]) == 0) - return i; + int ret = match_string(eq_mode_name, ARRAY_SIZE(eq_mode_name), name); /* Shouldn't happen */ - dev_err(component->dev, "Bad EQ channel name '%s'\n", name); + if (ret < 0) + dev_err(component->dev, "Bad EQ channel name '%s'\n", name); return -EINVAL; } -- 1.7.12.4