Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp372657ybi; Fri, 26 Jul 2019 11:09:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwY1Jqr4TZDb/9Q8wIiw6+qjbneWfzhkw0M0SFfM2aHbYTfr+V0Y7e6W3Zu2lhEKjPdahLl X-Received: by 2002:a17:902:110b:: with SMTP id d11mr101862730pla.213.1564164595101; Fri, 26 Jul 2019 11:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564164595; cv=none; d=google.com; s=arc-20160816; b=MQHW6jdnzLysHH1U+0Fedc12B6PeLrFkcc0niRfj/2KRcOmVbSWOI5rV7GNaRE1HUY dxVYiz2zJ798jBU2vy5SYpHtgDRQbRGfyj0TRHzVC00+eVI+SxVSaGRUK6txMLajX6/s Eyu0OkQN36dnBGJGtW2oHRvyGBtkLyRPP1JU2YJGmdZi7/lgEMFP/N8Qjeas9QnNO1a0 msrCL8Aos1/GcMF3TlF94UfzbT4Vk2PmTPhNIx7o55lBuPCNc2aI2zOTuqSILhUoQYEn PojfPdEAqLAIyUZcPCh1q5KdvxhB0Ifiavv8VJQZv413ELLM8hEg4ZOROIQGWyQv4DaF o2WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Cp0mpSQb5Nqbf9ird0b2lUQHpCamHQCXP51G+UnTmUI=; b=y9LLcJLJqmDNJMLIO4aCxiSszKdr49b5pxHl+WbeMTNcZmMjt7HONsxe8ZGvENhhHI 6kwKeIgKHeZvZII6BDp/m6+eQHUJIRcxwHZnU+vz7yuVwMeTGuM7GZZrM6vSze4SzFZp FYcP23kqV+NsylaD7xedMA2wzGVjgar1gCnfFJj95qL9zv8Adfekf941+upx8UhFKUv8 Z8KWQVCoUv1Sy4l+4g2io2HdvxI3nQpv/lQm70EGdZGMUQHvTALsDC4m//Jsx6H03Nsg GxbPhVARblHPcn33dWLke6llCmMGLZW0VvfE/9yvX3U+Go0Og+tZ39t7/wG8XJiWBMyC X8zg== 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 g13si21280548pfo.22.2019.07.26.11.09.39; Fri, 26 Jul 2019 11:09:55 -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 S2387730AbfGZPF5 (ORCPT + 99 others); Fri, 26 Jul 2019 11:05:57 -0400 Received: from mga03.intel.com ([134.134.136.65]:54533 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387661AbfGZPF5 (ORCPT ); Fri, 26 Jul 2019 11:05:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2019 08:05:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,311,1559545200"; d="scan'208";a="322060204" Received: from msmall-mobl.amr.corp.intel.com (HELO [10.251.154.62]) ([10.251.154.62]) by orsmga004.jf.intel.com with ESMTP; 26 Jul 2019 08:05:55 -0700 Subject: Re: [alsa-devel] [RFC PATCH 23/40] soundwire: stream: fix disable sequence To: Guennadi Liakhovetski 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 References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-24-pierre-louis.bossart@linux.intel.com> <20190726145129.GI16003@ubuntu> From: Pierre-Louis Bossart Message-ID: <8ec39464-81f7-e29d-7a2c-b2903a7fbf60@linux.intel.com> Date: Fri, 26 Jul 2019 10:05:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190726145129.GI16003@ubuntu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: will look at this, thanks. > > 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... will look at this, thanks Guennadi > > 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;