Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2221846imm; Thu, 18 Oct 2018 10:56:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV60a4AxzKDE4k+UmYGqlQpFcIaNDcDn3Tu8GzFd1bdKPPDuVB3NPYAMS6sC8v0WQysmdMO9W X-Received: by 2002:a62:4e09:: with SMTP id c9-v6mr31463245pfb.105.1539885400844; Thu, 18 Oct 2018 10:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539885400; cv=none; d=google.com; s=arc-20160816; b=lRUvR035xoFcrAJKYRxbp6mkcXM4zEvifk3+Y4FwG6JI8eFp5gfcA9D0IAc7uQRrn6 hmHRzPor6fl0KeD3SxA9khocjXEN0vTsijQtxEfTou32gVh8Sa6z1Swk5mzk/5eu3yqw mo2y8L0w3ry05AcSckcsLpsQiUBleQaoFamwWvTY+yob10caa5XGI+4JrZNYcZc6N7wg HTA0VHLKp34r1yAVGifhYGX/8oosBBqLfTZm+lxyishuTvUNNEObvzWIapmrm1HlJn9Q xd3p2gZf3zTaeAbBoie9XDW9N8cjhw5YKOl7XYgWp8KdYyAaaWTEENEORJ0Mw6sy9ZsW aK8g== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NQCwEH3GD28AiRAMMC+rVyzatb+QBn8gfeIIXKWxm4s=; b=IvVrDlGSLjHMNo3OwfIA9SV13Bam1qmRZf1AxQ1ftdYHKVlHgeyqyDCgo3TfqYLU60 FztdbxH2GEPaa69hAq3z801NcpiXjBTN2Wfu2NWTv1/aOUfJCSXb601sYFfv40NylO8O /aPzZuZWbYG9VNgbkrqek50Ks2BUekJj19laMRxOak4qy2RTdZAFr1K5xEZmIo1oLe9r ycnAO8/5Fe9o9eNql1UT0co/W3YY0P0dEGYlb+Ujb7oqT1pDyLW+sNOMiYBdzKHuIOH7 M5N7XqU3d710uD/HL/K5Ki+t5w4ikiYAXPXjSCfBUopFW75jEpzSYcCvdP4s7HL15q22 SqjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uS0rgKpW; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5-v6si21525967pgk.159.2018.10.18.10.56.25; Thu, 18 Oct 2018 10:56:40 -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=uS0rgKpW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728298AbeJSB5r (ORCPT + 99 others); Thu, 18 Oct 2018 21:57:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:45806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726507AbeJSB5r (ORCPT ); Thu, 18 Oct 2018 21:57:47 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 660BF204FD; Thu, 18 Oct 2018 17:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885343; bh=rLFHc0IzZwsxaPeCqbs0uB/D1U9M/2obvFCtSpm43CM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uS0rgKpWn+NHvPTiF/gU8lmpOw6l46SSalvXqmo/tBzsV5QHlE1ke1V3SsN9FBahl UgdBvRPDAN5Gd5Q4ghAnUcEFG7yCoYD6lrSna+zwkse8MCbPnF+v1vhl63ozam36dO NXzGfDKQO4vPZKb7ZnD+wBYaYUpwifeU3JGaNbdo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shreyas NC , Pierre-Louis Bossart , Vinod Koul , Sasha Levin Subject: [PATCH 4.18 01/53] soundwire: Fix duplicate stream state assignment Date: Thu, 18 Oct 2018 19:53:54 +0200 Message-Id: <20181018175416.791968288@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175416.561567978@linuxfoundation.org> References: <20181018175416.561567978@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/soundwire/stream.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -1123,8 +1123,6 @@ int sdw_stream_add_master(struct sdw_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_slav 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;