From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09668C7618B for ; Fri, 26 Jul 2019 14:17:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4E9022ADA for ; Fri, 26 Jul 2019 14:17:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728392AbfGZORy (ORCPT ); Fri, 26 Jul 2019 10:17:54 -0400 Received: from mga01.intel.com ([192.55.52.88]:4937 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727358AbfGZORy (ORCPT ); Fri, 26 Jul 2019 10:17:54 -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 fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2019 07:17:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,311,1559545200"; d="scan'208";a="322051074" 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 07:17:52 -0700 Subject: Re: [alsa-devel] [RFC PATCH 23/40] soundwire: stream: fix disable sequence To: Cezary Rojewski Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, 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> <492d7897-973d-f207-46d5-f2f554645df7@intel.com> From: Pierre-Louis Bossart Message-ID: <68948dd2-e131-7ef2-3067-ea5286e2f6d0@linux.intel.com> Date: Fri, 26 Jul 2019 09:17:52 -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: <492d7897-973d-f207-46d5-f2f554645df7@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/26/19 5:14 AM, Cezary Rojewski wrote: > On 2019-07-26 01:40, Pierre-Louis Bossart wrote: >> -    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; >> +        /* 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; >>   } >>   /** >> > > While not directly connected to this commit, I see that you do: > link_for_each_entry(m_rt, &stream->master_list, stream_node) > > quite often in /stream.c code. Helpful macro would prove useful. Yes, but the flip side is that people need to look at what the macro does to figure it out, while everyone knows what list_for_each_entry() means. Not sure about this one. And on top of this we'll probably have to rework this code to have a background copy of the current bank in the alternate bank so it'd rather leave it simple for now.