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=-12.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS autolearn=ham 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 02972C04AA7 for ; Mon, 13 May 2019 12:30:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4F6420879 for ; Mon, 13 May 2019 12:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557750634; bh=zXWihy9zcArLnFvtZjWlzm+v/H+XbJ/HmArE+KSKov0=; h=From:To:Cc:Subject:In-Reply-To:Date:List-ID:From; b=mmQSh68DhT6Nmy6Q7peGufweVoNNeuPgU1j4D1bZ83x92J0Gji3XYu9BF5kx9+ijT kC12XoJala2aJeV65KVAYU3VdQTMA6xO/AOxMlctfMpFiLmX0Gf5F97NuVc0Ri6fXL 46cSp3WU09V5BOrR1V8mCtqzE7sjgQjQY/5aA9tk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729131AbfEMMad (ORCPT ); Mon, 13 May 2019 08:30:33 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:56322 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727132AbfEMMad (ORCPT ); Mon, 13 May 2019 08:30:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=FjQ+dnaEIl4gFNgh5qq4Z14zi4KnDS1kuCbKDL+ttw8=; b=OgX9Y8+6LFcE H7NbkG5y67FRf9T9Y9TXVq1mtc93toobqvszxkg9P9UV6KcE50BAQPAD52fG7cDIFGh+OLdoyyLPb 947tVkay8/JfJPKm/hEzwcMVJACUG53oMHoArpsapkjPJknLgNZyKRR/ovXNtcDMe7D3IVsiSdgds D80WE=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1hQA67-0006WQ-Jx; Mon, 13 May 2019 12:30:27 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 151071129232; Mon, 13 May 2019 13:30:26 +0100 (BST) From: Mark Brown To: Jerome Brunet Cc: alsa-devel@alsa-project.org, Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , patchwork-bot+notify@kernel.org Subject: Applied "ASoC: hdmi-codec: re-introduce mutex locking" to the asoc tree In-Reply-To: <20190513081847.31140-1-jbrunet@baylibre.com> X-Patchwork-Hint: ignore Message-Id: <20190513123026.151071129232@debutante.sirena.org.uk> Date: Mon, 13 May 2019 13:30:26 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: hdmi-codec: re-introduce mutex locking has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From eb1ecadb7f67dde94ef0efd3ddaed5cb6c9a65ed Mon Sep 17 00:00:00 2001 From: Jerome Brunet Date: Mon, 13 May 2019 10:18:47 +0200 Subject: [PATCH] ASoC: hdmi-codec: re-introduce mutex locking Replace the bit atomic operations by a mutex to ensure only one dai at a time is active on the hdmi codec. This is a follow up on change: 3fcf94ef4d41 ("ASoC: hdmi-codec: remove reference to the current substream") Suggested-by: Mark Brown Signed-off-by: Jerome Brunet Signed-off-by: Mark Brown --- sound/soc/codecs/hdmi-codec.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 90a892766625..6a0cc8d7e141 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -281,7 +281,7 @@ struct hdmi_codec_priv { uint8_t eld[MAX_ELD_BYTES]; struct snd_pcm_chmap *chmap_info; unsigned int chmap_idx; - unsigned long busy; + struct mutex lock; }; static const struct snd_soc_dapm_widget hdmi_widgets[] = { @@ -395,8 +395,8 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); int ret = 0; - ret = test_and_set_bit(0, &hcp->busy); - if (ret) { + ret = mutex_trylock(&hcp->lock); + if (!ret) { dev_err(dai->dev, "Only one simultaneous stream supported!\n"); return -EINVAL; } @@ -424,7 +424,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, err: /* Release the exclusive lock on error */ - clear_bit(0, &hcp->busy); + mutex_unlock(&hcp->lock); return ret; } @@ -436,7 +436,7 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream, hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); - clear_bit(0, &hcp->busy); + mutex_unlock(&hcp->lock); } static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, @@ -773,6 +773,8 @@ static int hdmi_codec_probe(struct platform_device *pdev) return -ENOMEM; hcp->hcd = *hcd; + mutex_init(&hcp->lock); + daidrv = devm_kcalloc(dev, dai_count, sizeof(*daidrv), GFP_KERNEL); if (!daidrv) return -ENOMEM; -- 2.20.1