Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3733934imm; Mon, 8 Oct 2018 08:41:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV61XMT9PJchQ/cTuwzRGTnayitgqbozf2t0UXNTvl9Va55jmKuIgBfRAf5ehbSVND455+nh0 X-Received: by 2002:a17:902:8690:: with SMTP id g16-v6mr23816815plo.302.1539013271773; Mon, 08 Oct 2018 08:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539013271; cv=none; d=google.com; s=arc-20160816; b=SrCgysNv9/CugJuLI1Z1CPRMuneKXjMZikixoBip9Ld95C+/1KTzCaUyLDVEKQoOi9 zB8rQoFDOzugPCjTPgz8KiCEka52xigXz1VLZMpn8Pb0cVEv8TXXfX+jeWZ89KEmhuWN 5kZXmnesACrhKSXLaeDMMjR0V6VWYBizHiiLY2YG4TZhBd1jSPSh4gTOIJayCC2bkhgt nJC/KZWUNq0vTFVJ7WsmsvrBPVABhU4fUQ/o7YAz2oxqw+tOlEqprpmaOiAkn3Xz7ypr XAI0AkDfiQu8Gdd1ujlrLG8gsUM+ZsObM0OEBV6cdLZKmJhXy8MlwM+MikD5J6NNUST2 hqjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=aWWcSYsK/OxqvCdPCNfozFeacEQaQMBvmB6wQuz2kts=; b=Ossp8IUu6pD4WSQNkDD/Ygl5cY+kgTg6zqOoqktjb6TYDAnc5UgzXBe6bOCjaCYT2x fZcb2/hNVj6EyNn9TFjAunb2aXNOOOwFyAgj+TkofuVKPne3AgIU0bC97TYlr8lm1ExQ 6cyzF0r0+ICeKLM5dAAArXv3zr/iXrdctIEyzO38wIItwQt3LZ0Dbt7SBR7eXcs/prdS 9EyKS/tSZA/KMFstRjzUCtrAjmlblTh1jujP1DuVhLRtXQJSCkvjedmZN0LLvvxCs1Ib uZKll0jEs/YFo8jHqnb3x1HfvoZq+NkUD/viIq86PS6ajMQPcQWsV1erZy0pUVIKm4bL uymw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="e/LOcZJ0"; 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=pass (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 n32-v6si17334950pgm.469.2018.10.08.08.40.57; Mon, 08 Oct 2018 08:41:11 -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=pass header.i=@kernel.org header.s=default header.b="e/LOcZJ0"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726529AbeJHWho (ORCPT + 99 others); Mon, 8 Oct 2018 18:37:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:55686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeJHWho (ORCPT ); Mon, 8 Oct 2018 18:37:44 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ABDA220644; Mon, 8 Oct 2018 15:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539012329; bh=nxDOOtF14Qw3It1GHli3S3pMmZ8ey/IS560+P8KM/SE=; h=From:To:Cc:Subject:Date:From; b=e/LOcZJ0VGn/co8hGdkJhUVwWhCSVXcqLMFut0KdfzYVPSQfZj02OMsDCsYnxgPFH FSrZfFbSRMX2X/1IW4epgLce1oWpvzkZ5uizEPs5LvdZP45FdJwtCHnx1lQDPdEnkc I8pYZYyt3Ne2Aj7FrnU92Xw2xWlYisojTVa6b+Tc= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Shreyas NC , Vinod Koul , Sasha Levin Subject: [PATCH AUTOSEL 4.18 01/58] soundwire: Fix duplicate stream state assignment Date: Mon, 8 Oct 2018 11:24:26 -0400 Message-Id: <20181008152523.70705-1-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shreyas NC [ Upstream commit 0aebe40bae6cf5652fdc3d05ecee15fbf5748194 ] For a SoundWire stream it is expected that a Slave is added to the stream before Master is added. So, move the stream state to CONFIGURED after the first Slave is added and remove the stream state assignment for Master add. Along with these changes, add additional comments to explain the same. Signed-off-by: Shreyas NC Acked-by: Pierre-Louis Bossart Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/soundwire/stream.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index 4b5e250e8615..7ba6d4d8cd03 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -1123,8 +1123,6 @@ int sdw_stream_add_master(struct sdw_bus *bus, if (ret) goto stream_error; - stream->state = SDW_STREAM_CONFIGURED; - stream_error: sdw_release_master_stream(stream); error: @@ -1141,6 +1139,10 @@ EXPORT_SYMBOL(sdw_stream_add_master); * @stream: SoundWire stream * @port_config: Port configuration for audio stream * @num_ports: Number of ports + * + * It is expected that Slave is added before adding Master + * to the Stream. + * */ int sdw_stream_add_slave(struct sdw_slave *slave, struct sdw_stream_config *stream_config, @@ -1186,6 +1188,12 @@ int sdw_stream_add_slave(struct sdw_slave *slave, if (ret) goto stream_error; + /* + * Change stream state to CONFIGURED on first Slave add. + * Bus is not aware of number of Slave(s) in a stream at this + * point so cannot depend on all Slave(s) to be added in order to + * change stream state to CONFIGURED. + */ stream->state = SDW_STREAM_CONFIGURED; goto error; -- 2.17.1