Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp776361imm; Thu, 31 May 2018 09:11:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL7J1aSG5w1Odpry0gbQJ/JD1qVxMiF7cQzCYYGA8imdVqnsFdFtEHxWh3eJueRxp1R+XPd X-Received: by 2002:a65:4a04:: with SMTP id s4-v6mr5957508pgq.376.1527783099439; Thu, 31 May 2018 09:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527783099; cv=none; d=google.com; s=arc-20160816; b=pAI27cpaLHJc0YRn970DklVR81FdWhQ/DyBMJ9vuuJFwwbQnowrD36jS6uxW1E8k9A IED5anFmNHnsxLkUUiz1d8zHoHQwWcFplAT5hgPy1+4L+wxoHIRbT9rNLy/850eX1JAE 8Hl3upoMdXDkB5GlOh1xVy1wAZhZuN0modlfRcVCKn5uIJWDdcE7LALTT9xrsQzFKWx1 GBaOa2lBNnsy+YA0Ag8Vy1A7uhe0HbZm2W5VBTRXY7jfnCxQVbf9o9tT4xWe4r6SFD4b IaWKaReoPKsfClr3rXJrZUIaCRoHLUPkmV7YLDu+jKx4DGYiWPHTg+FLLvYKNW7jEWLl 0yaw== 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=98jR63y1ruxw9xM1PUhx1nUrjLHr7Kfco0ODg8eTgFU=; b=tgXNUcM0AQ61his1Nviu/bCRSXwGvfJ423JkZIDfu+BDQLZsNqXSssSA1qqhDzbPmB vlFvW/9s24zUCiXOEm9qz54qb6QXY9diLfBWSbVlRKh5m4bSEalIsw+JlcahfSyNEbLp kFNWdBb7bFCXUON/cJ2HYGOVoKnUizfsWPw36/VqdRlevzsHIRG7QF3kJvV0oIXDLUGy rvk+cJVs4HPZKiTWyb9vRZEcatsXE3TjUaCYjdkBEXiNczFRENziq+Zxq/d72qMsLP/3 IkFdzWJ1l+Jg7dW9lgWK5XjbFnrNi00MOxQorZOz5ChO7qj9jeEl2KeBlI75zqK+E6JC i2tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=XxMi1tQ0; 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 l30-v6si37244762plg.420.2018.05.31.09.11.25; Thu, 31 May 2018 09: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; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=XxMi1tQ0; 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 S1755605AbeEaQJn (ORCPT + 99 others); Thu, 31 May 2018 12:09:43 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:51390 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755578AbeEaQJl (ORCPT ); Thu, 31 May 2018 12:09:41 -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=98jR63y1ruxw9xM1PUhx1nUrjLHr7Kfco0ODg8eTgFU=; b=XxMi1tQ0QGB4 btMPJVjHOm0USG5Qk1Ziz8kT7rKxBoa+sYDCgEqCu19W3jjCJ1rBtoR2HdSfTW7DgrPhffgvXl22P la0NLYm9C6s8Lk4KuLB7J9J7tz0Oz6wvTe7jTvM5dbtCdiepsGEPBoDUKh4YpH5eukBhHPrTfqnB4 N4AOQ=; 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 1fOQ8w-0000Il-MM; Thu, 31 May 2018 16:09:38 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fOQ8w-0003A4-5a; Thu, 31 May 2018 17:09:38 +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 , Mark Brown , alsa-devel@alsa-project.org Subject: Applied "ASoC: dapm: use match_string() helper" to the asoc tree In-Reply-To: <1526903890-35761-34-git-send-email-xieyisheng1@huawei.com> Message-Id: Date: Thu, 31 May 2018 17:09:38 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: dapm: 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 f9e0b4afd4e9b19e95158962d81b5b776d57ca06 Mon Sep 17 00:00:00 2001 From: Xie Yisheng Date: Thu, 31 May 2018 19:11:23 +0800 Subject: [PATCH] ASoC: dapm: 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. Reviewed-by: Andy Shevchenko 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/soc-dapm.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 2d9709104ec5..1e9a36389667 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -724,18 +724,14 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm, item = 0; } - for (i = 0; i < e->items; i++) { - if (!(strcmp(control_name, e->texts[i]))) { - path->name = e->texts[i]; - if (i == item) - path->connect = 1; - else - path->connect = 0; - return 0; - } - } + i = match_string(e->texts, e->items, control_name); + if (i < 0) + return -ENODEV; + + path->name = e->texts[i]; + path->connect = (i == item); + return 0; - return -ENODEV; } /* set up initial codec paths */ -- 2.17.0