Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp775276imm; Thu, 31 May 2018 09:10:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIOg1GmfnCkMTHn80NknUvMJp6tUxxXecvAq7gnTU0QKLsLheBgUb2DWS9n8K9tFJhi2KaH X-Received: by 2002:a62:1e02:: with SMTP id e2-v6mr7403788pfe.212.1527783040070; Thu, 31 May 2018 09:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527783040; cv=none; d=google.com; s=arc-20160816; b=kf7BzQ3VitPT5Q4q3mjNLHODAX1zSUIzpNPVCiihDcacAH2XohQJAiOzwprIWOUW1d UKW8B9JxXWzs8r2CxLJCMp+hUIMw+tR9/XXrZQ66QFxDls8WnHCx2yhZk8lRTQVUBc7R ns4gHApw6IwFnaX+jugHa1RwOGsolcFuA2+DRno6lJww0SGfW1H07LB7hzG+8DTA6/Uc 0kgnnz1zq6E33UP0wdrT+OhsjLPil9RfM4kko9CMkF1ldu40ZMxb9baeMferv4BHWjdy +dzNx/2F5RRRiG6bp01mZrjTSh5las0q00r6aL+o7fET20HfA0azv+s2ifOgtp/AJBqK 53cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=Fl792bzrLAdv34TPav5T0CYj9fyk7X7512ZW/mx5uoM=; b=0AZIWEd7uqpe98kTpnREnuo380KKOZ4AcEcGhgcrcR0/rfAXxnWfnFvExNfddm+9ut 45q/nOVGb1ihWMFNJeKqF+E/ACQyD/zIgXIV2wMQxTfw/jGMH2i4ccboWlU8CJ0tat2i w9tnReWoqBqwxO6pd0KXV+ftLma4sdAYe+ktZr9wg4wOWd7Ibe7vOgSV/KavkNRclnDA t8JNmvZYk7bTwmK5yAvps5KBun3IPCwruzWWIz01Xqy4nPAMnlel8SZC4Acl1zIqKfGy WRtvAk45noQ+mx5+LfzzEcqUaofy3IHTpnq1XOCSBh8HEl6LD7Fqv5Oiz1DomCcyFcH6 yVaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=UeIf0bK9; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1-v6si37159220plb.8.2018.05.31.09.10.25; Thu, 31 May 2018 09:10:40 -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; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=UeIf0bK9; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755657AbeEaQJw (ORCPT + 99 others); Thu, 31 May 2018 12:09:52 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:51542 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755616AbeEaQJr (ORCPT ); Thu, 31 May 2018 12:09:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=Fl792bzrLAdv34TPav5T0CYj9fyk7X7512ZW/mx5uoM=; b=UeIf0bK9NBI6 pLhblXrIOgDjF2gpbcpYcxVWfnqxee6Ktf2B9OK3VCI1UXs1EPQnQX4Hx//yupg34DkRFJY5e1GqJ ct8VUVEvTndYvhsyWTETA8FEPwXEzGCS/4LzBwm76sNMNjThbTN0Se2D7BAqy2oo/H1hlvRgJcR7p fLbDk=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOQ93-0000Iw-OS; Thu, 31 May 2018 16:09:45 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fOQ93-0003CU-AS; Thu, 31 May 2018 17:09:45 +0100 From: Mark Brown To: Xie Yisheng Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, Yisheng Xie , Mark Brown , linux-kernel@vger.kernel.org, Yisheng Xie , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , andy.shevchenko@gmail.com, Mark Brown , alsa-devel@alsa-project.org Subject: Applied "ASoC: max98088: use match_string() helper" to the asoc tree In-Reply-To: <1527765086-19873-17-git-send-email-xieyisheng1@huawei.com> Message-Id: Date: Thu, 31 May 2018 17:09:45 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: max98088: use match_string() helper has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 3470631510fa383feac5969b436499ca9bad03b8 Mon Sep 17 00:00:00 2001 From: Xie Yisheng Date: Thu, 31 May 2018 19:11:21 +0800 Subject: [PATCH] ASoC: max98088: use match_string() helper match_string() returns the index of an array for a matching string, which can be used instead 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 Signed-off-by: Mark Brown --- sound/soc/codecs/max98088.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 865f64c40b79..fb515aaa54fc 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1382,15 +1382,12 @@ static const char *eq_mode_name[] = {"EQ1 Mode", "EQ2 Mode"}; static int max98088_get_channel(struct snd_soc_component *component, const char *name) { - int i; + int ret; - for (i = 0; i < ARRAY_SIZE(eq_mode_name); i++) - if (strcmp(name, eq_mode_name[i]) == 0) - return i; - - /* Shouldn't happen */ - dev_err(component->dev, "Bad EQ channel name '%s'\n", name); - return -EINVAL; + ret = match_string(eq_mode_name, ARRAY_SIZE(eq_mode_name), name); + if (ret < 0) + dev_err(component->dev, "Bad EQ channel name '%s'\n", name); + return ret; } static void max98088_setup_eq1(struct snd_soc_component *component) -- 2.17.0