Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp370483ybi; Fri, 26 Jul 2019 11:07:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOENTEF4EB6Z54ZRESyt8ndrPNyLZr3LzFrojSS/HNohHcd1hOaf+uKVnOn0/ozh8RbTcT X-Received: by 2002:a17:90a:290b:: with SMTP id g11mr99696194pjd.122.1564164472647; Fri, 26 Jul 2019 11:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564164472; cv=none; d=google.com; s=arc-20160816; b=uUSeJMgqnMj1ci6RY8glKimS3vrIbSdFoOEYZlbLyR/i1e5nZINLlBTWQRscNZDDlY 5d1AWk0j29HyM6CxGBTAadvtu69gRMJGUqJmPlLGAytQjW2G0+Xog25cGklpqL+/cCr+ kdAshcTWZGCIFozLixXpJ0XugIURBrVjMcJcJORlvFVk37p2PGqUfvWvn9CO2ShKhS24 wZktutR3gsRpJFM7f4v6OWCgqd6aSH141E1E+s06nMMPDLliHtFJJdlAI7vPa96Qghli rcTC8iaLGDWvxnoX5eLp1lxdq3z5XaAWVmoj7WvY+eUv9Xyh59ansHNtBRirj0oQ2n+u +Btw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=moQR2UbC32o2pbDgxt+UV4QMLE2EqM9ytgQubk/zyS0=; b=mqm8RKWFuQvWp/ER5V4rYMLsNRWCXPe4FbB46EzKoe68K7J16++HLwVjq74AHMRElD pzhFRxTPSd/1gfk68UtdkhXIMhn0zgPcSOd9LhbQlr8zBzVfGTY4rLProsBt74WMIiEY i8z9MuEGBvXtuX5pC/U7AC+4k1SbneM8BwDzZM3Om4y6Z35/7NWowlA8XFFR+ZmkGwaw XAx/muD+zH+1hiBGkf5BBTmFiORN0tLiYhks0Uu5mdWl4BCz7LbvljSFr73XSCDGs20K 6BpC0eDcnLfckSgqIR1bIljZVhkSDYjrPtYihUceO9a5hau/cf83S08HgC0JkfnaJXRo MfmA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si19780723plr.134.2019.07.26.11.07.37; Fri, 26 Jul 2019 11:07:52 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387576AbfGZOve (ORCPT + 99 others); Fri, 26 Jul 2019 10:51:34 -0400 Received: from mga03.intel.com ([134.134.136.65]:53591 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387532AbfGZOvd (ORCPT ); Fri, 26 Jul 2019 10:51:33 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2019 07:51:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,311,1559545200"; d="scan'208";a="370101454" Received: from gliakhov-mobl2.ger.corp.intel.com (HELO ubuntu) ([10.249.35.244]) by fmsmga006.fm.intel.com with ESMTP; 26 Jul 2019 07:51:30 -0700 Date: Fri, 26 Jul 2019 16:51:29 +0200 From: Guennadi Liakhovetski To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Sanyog Kale Subject: Re: [alsa-devel] [RFC PATCH 23/40] soundwire: stream: fix disable sequence Message-ID: <20190726145129.GI16003@ubuntu> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-24-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190725234032.21152-24-pierre-louis.bossart@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unrelated to this specific patch, but I looked at _sdw_disable_stream() and I see this there (again, maybe my version is outdated already): struct sdw_master_runtime *m_rt = NULL; struct sdw_bus *bus = NULL; where both those initialisations are redundant. Moreover: On Thu, Jul 25, 2019 at 06:40:15PM -0500, Pierre-Louis Bossart wrote: > When we disable the stream and then call hw_free, two bank switches > will be handled and as a result we re-enable the stream on hw_free. > > Make sure the stream is disabled on both banks. > > TODO: we need to completely revisit all this and make sure we have a > mirroring mechanism between current and alternate banks. > > Signed-off-by: Pierre-Louis Bossart > --- > drivers/soundwire/stream.c | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c > index 53f5e790fcd7..75b9ad1fb1a6 100644 > --- a/drivers/soundwire/stream.c > +++ b/drivers/soundwire/stream.c > @@ -1637,7 +1637,24 @@ static int _sdw_disable_stream(struct sdw_stream_runtime *stream) > } > } > > - return do_bank_switch(stream); > + ret = do_bank_switch(stream); > + if (ret < 0) { > + dev_err(bus->dev, "Bank switch failed: %d\n", ret); > + return ret; > + } > + > + /* make sure alternate bank (previous current) is also disabled */ > + list_for_each_entry(m_rt, &stream->master_list, stream_node) { > + bus = m_rt->bus; "bus" is only used below, so at least take that line under "if (ret < 0)" or even just do "dev_err(m_rt->bus->dev,...)" everywhere in this function and remove the variable altogether... Thanks Guennadi > + /* Disable port(s) */ > + ret = sdw_enable_disable_ports(m_rt, false); > + if (ret < 0) { > + dev_err(bus->dev, "Disable port(s) failed: %d\n", ret); > + return ret; > + } > + } > + > + return 0; > } > > /** > -- > 2.20.1 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel