Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7024346ybi; Mon, 22 Jul 2019 05:54:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwptmNGwSzXW2YpS6GrsnFrs2K5SJZMVyuerTx1RfTOYvTc9D9Y22QTD9B81Cllp6aBF/if X-Received: by 2002:aa7:9092:: with SMTP id i18mr105981pfa.101.1563800084072; Mon, 22 Jul 2019 05:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563800084; cv=none; d=google.com; s=arc-20160816; b=KoKpzYeeMS9PzxcLO3+82Hnwr+uNDMnk7MHsJlnA8N3sb+A3dxW6QHbpLniLQPlx8S S2JpgHZ0rGlC9kguel6+vcUYbECUigNMH91/LLnu0dFG6ySz8RXDZENKgMVbcY9UaCVa jreExxXtxgpZvC2OLNqKSYOD4A7wRPfA8Q9dMBqgnnttOIZziGGOx7nEnaav8RiHYhSO r7w3Zo8gpOgjyvzbtEHvXMx17J9L/v6IXonGgexc+KM0QLm6MGDRY6KVo7ucusdqfSaq 6TC73hkzWIiEibN2hsobOX0IAKCVyyf5E+a2RVu+yB7BEgAnn7UCv3bnevJtsdmZMkPG TVjw== 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; bh=4i4IQGKuET0d337RiOFYQXjcUPaTk8GsmqOZaN1H8co=; b=YK1JEzeE5Vyj9dLpvEvLQ5tGcUZtdVCqCtxxFu/xpi2Zc00FohBkvwYYP41S09lhqb MpG2KH4ngtFcPus8jB6/WNp2Iked8qWsgiWEh/0ITgUJV1dkiArJTnEI5tMPYJ5YpKRk GyIsijurX0CgoipHwnTEZo3Drxr5kiDdStN0UszocwPuQHP7DkkZQxg24gNIPwb90QzQ dds3mwl+63vg0E2AWlmYBTDcsEqDmZun/aDEM/mcuH67ELEZTl3KAjpOwQMUiw0jl6FP oEpIH1QHZUmWBoJNHuBBhKqqXy1Abi8pocaEpt2paN8ufZCMN7e4QPSEWVcB7b2Bd0VP IrIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=romRoRNZ; 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 u2si9010651pjb.25.2019.07.22.05.54.28; Mon, 22 Jul 2019 05:54:44 -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=romRoRNZ; 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 S1729298AbfGVMWQ (ORCPT + 99 others); Mon, 22 Jul 2019 08:22:16 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:58450 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728802AbfGVMWQ (ORCPT ); Mon, 22 Jul 2019 08:22:16 -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=4i4IQGKuET0d337RiOFYQXjcUPaTk8GsmqOZaN1H8co=; b=romRoRNZyizb KUa6vwp84xK7GLcDGP/Fqy6Pzeucf946AgHmvWl15YY6Fn8JwQuQuQgMjlCOFGQ23xM9jiVxWZv1a 3gJCYOOG1a8vHOBJ39SdYcG6Q1hL+/gc89JzRZFH1S3webTKF23kV+Inmy8QLQiI/civdOi2RggeX 5Gotg=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=ypsilon.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hpXKV-0007e4-19; Mon, 22 Jul 2019 12:22:11 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id 7A072274046A; Mon, 22 Jul 2019 13:22:10 +0100 (BST) From: Mark Brown To: Charles Keepax Cc: alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, Mark Brown , patches@opensource.cirrus.com Subject: Applied "ASoC: dapm: Fix handling of custom_stop_condition on DAPM graph walks" to the asoc tree In-Reply-To: <20190718084333.15598-1-ckeepax@opensource.cirrus.com> X-Patchwork-Hint: ignore Message-Id: <20190722122210.7A072274046A@ypsilon.sirena.org.uk> Date: Mon, 22 Jul 2019 13:22:10 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: dapm: Fix handling of custom_stop_condition on DAPM graph walks has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3 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 8dd26dff00c0636b1d8621acaeef3f6f3a39dd77 Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Thu, 18 Jul 2019 09:43:33 +0100 Subject: [PATCH] ASoC: dapm: Fix handling of custom_stop_condition on DAPM graph walks DPCM uses snd_soc_dapm_dai_get_connected_widgets to build a list of the widgets connected to a specific front end DAI so it can search through this list for available back end DAIs. The custom_stop_condition was added to is_connected_ep to facilitate this list not containing more widgets than is necessary. Doing so both speeds up the DPCM handling as less widgets need to be searched and avoids issues with CODEC to CODEC links as these would be confused with back end DAIs if they appeared in the list of available widgets. custom_stop_condition was implemented by aborting the graph walk when the condition is triggered, however there is an issue with this approach. Whilst walking the graph is_connected_ep should update the endpoints cache on each widget, if the walk is aborted the number of attached end points is unknown for that sub-graph. When the stop condition triggered, the original patch ignored the triggering widget and returned zero connected end points; a later patch updated this to set the triggering widget's cache to 1 and return that. Both of these approaches result in inaccurate values being stored in various end point caches as the values propagate back through the graph, which can result in later issues with widgets powering/not powering unexpectedly. As the original goal was to reduce the size of the widget list passed to the DPCM code, the simplest solution is to limit the functionality of the custom_stop_condition to the widget list. This means the rest of the graph will still be processed resulting in correct end point caches, but only widgets up to the stop condition will be added to the returned widget list. Fixes: 6742064aef7f ("ASoC: dapm: support user-defined stop condition in dai_get_connected_widgets") Fixes: 5fdd022c2026 ("ASoC: dpcm: play nice with CODEC<->CODEC links") Fixes: 09464974eaa8 ("ASoC: dapm: Fix to return correct path list in is_connected_ep.") Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20190718084333.15598-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 6b44b4a78b8e..9cd87e47ee8f 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1157,8 +1157,8 @@ static __always_inline int is_connected_ep(struct snd_soc_dapm_widget *widget, list_add_tail(&widget->work_list, list); if (custom_stop_condition && custom_stop_condition(widget, dir)) { - widget->endpoints[dir] = 1; - return widget->endpoints[dir]; + list = NULL; + custom_stop_condition = NULL; } if ((widget->is_ep & SND_SOC_DAPM_DIR_TO_EP(dir)) && widget->connected) { @@ -1195,8 +1195,8 @@ static __always_inline int is_connected_ep(struct snd_soc_dapm_widget *widget, * * Optionally, can be supplied with a function acting as a stopping condition. * This function takes the dapm widget currently being examined and the walk - * direction as an arguments, it should return true if the walk should be - * stopped and false otherwise. + * direction as an arguments, it should return true if widgets from that point + * in the graph onwards should not be added to the widget list. */ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, struct list_head *list, -- 2.20.1