From patchwork Thu Apr 24 12:01:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit Cousson X-Patchwork-Id: 4050151 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 49C39BFF02 for ; Thu, 24 Apr 2014 12:04:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A94720303 for ; Thu, 24 Apr 2014 12:04:36 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EDBC1202DD for ; Thu, 24 Apr 2014 12:04:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1916926530D; Thu, 24 Apr 2014 14:04:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id D8F082652F4; Thu, 24 Apr 2014 14:03:05 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id A362B2652D7; Thu, 24 Apr 2014 14:03:04 +0200 (CEST) Received: from mail-we0-f180.google.com (mail-we0-f180.google.com [74.125.82.180]) by alsa0.perex.cz (Postfix) with ESMTP id 7C8F5265253 for ; Thu, 24 Apr 2014 14:02:23 +0200 (CEST) Received: by mail-we0-f180.google.com with SMTP id k48so2099844wev.25 for ; Thu, 24 Apr 2014 05:02:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JvdH3il72iDlksq6NnHoF/OKeDZCB62J70dE51RXbis=; b=OntWI+MTpBWTkAsdBv2bj1j6grwgVTeKTrCyLsDyHyK52Pmz1arr5SQQg6huxxVXKx implsLLP6Rf6oZYJCcjj2pPxdnMf5W9C8so0Xx5YetReyIe+9mPfkC/xjURXxzBaVSHd vOEZLLLgpKOIr954t0nX5EHxwhP8uepd1u5PjK9nz7braw0zne5pS4AF32XB4puW969T b9BgYoOuMmWfPpSR41Gwmf9LgB9YEVkX8R+83PIu+5b7KHTd5jq9ThBFLS+18h4N+hS2 2iZ6i5irjK1NR3sm1/cjbwlslSe3LlIexOxmgqr61daQ3Nh3aMHcwPX86IOdJQXOsyRa EbPg== X-Gm-Message-State: ALoCoQncVB0YhPtJUlOrFJ34whRkNtFY5FyCw4S2aQ5BPHJhIvgVQPUZk1qYK4+b6sFC2BW4Rtlc X-Received: by 10.194.161.168 with SMTP id xt8mr1309113wjb.35.1398340943175; Thu, 24 Apr 2014 05:02:23 -0700 (PDT) Received: from localhost.localdomain ([46.218.123.34]) by mx.google.com with ESMTPSA id wl6sm5926963wjb.3.2014.04.24.05.02.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 05:02:22 -0700 (PDT) From: Benoit Cousson To: broonie@kernel.org, lgirdwood@gmail.com, lars@metafoo.de Date: Thu, 24 Apr 2014 14:01:45 +0200 Message-Id: <1398340906-5017-3-git-send-email-bcousson@baylibre.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398340906-5017-1-git-send-email-bcousson@baylibre.com> References: <1398340906-5017-1-git-send-email-bcousson@baylibre.com> Cc: misael.lopez@ti.com, alsa-devel@alsa-project.org, Benoit Cousson Subject: [alsa-devel] [RFT v3 2/3] ASoC: core: Add one dai_get_widget helper instead of two rtd based ones X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Replace rtd_get_codec_widget() and rtd_get_cpu_widget() by a simple dai_get_widget() in preparation for DAI-multicodec support, per Lars suggestion. No functional change. Signed-off-by: Benoit Cousson Cc: Lars-Peter Clausen --- sound/soc/soc-pcm.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 2cedf09..88230ea 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1012,21 +1012,12 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card, } static inline struct snd_soc_dapm_widget * - rtd_get_cpu_widget(struct snd_soc_pcm_runtime *rtd, int stream) + dai_get_widget(struct snd_soc_dai *dai, int stream) { if (stream == SNDRV_PCM_STREAM_PLAYBACK) - return rtd->cpu_dai->playback_widget; + return dai->playback_widget; else - return rtd->cpu_dai->capture_widget; -} - -static inline struct snd_soc_dapm_widget * - rtd_get_codec_widget(struct snd_soc_pcm_runtime *rtd, int stream) -{ - if (stream == SNDRV_PCM_STREAM_PLAYBACK) - return rtd->codec_dai->playback_widget; - else - return rtd->codec_dai->capture_widget; + return dai->capture_widget; } static int widget_in_list(struct snd_soc_dapm_widget_list *list, @@ -1076,14 +1067,14 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) { /* is there a valid CPU DAI widget for this BE */ - widget = rtd_get_cpu_widget(dpcm->be, stream); + widget = dai_get_widget(dpcm->be->cpu_dai, stream); /* prune the BE if it's no longer in our active list */ if (widget && widget_in_list(list, widget)) continue; /* is there a valid CODEC DAI widget for this BE */ - widget = rtd_get_codec_widget(dpcm->be, stream); + widget = dai_get_widget(dpcm->be->codec_dai, stream); /* prune the BE if it's no longer in our active list */ if (widget && widget_in_list(list, widget))