Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3760457ybl; Mon, 13 Jan 2020 02:06:21 -0800 (PST) X-Google-Smtp-Source: APXvYqyATf5iKGc3MSN9WJQFjHvTnye8IVknQ3f89Zl8pqbjheO+lCPikboGZ0zrCV8T0ozV1wJa X-Received: by 2002:a9d:1e4:: with SMTP id e91mr12794977ote.324.1578909981618; Mon, 13 Jan 2020 02:06:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578909981; cv=none; d=google.com; s=arc-20160816; b=QkJjNpczxt60TLD0Fdj4f7bUOrqgD+HTVFzELQ3PF7xqT4u5UkE0bqpJGHgIizuroJ +/4wMMKG1/lrfHkWTDjJTJmPHQOiVZlRo8zFEq9q/2vMLWJSXnrYP1+ffkroK63WnX6h MHRMQ32iKOXCYzn413bIZAfFWDEuhTz4Urhd6dAkmDs5OAxbXSYj6JK64JZ2TKB848NB Nmlc2tFJvXgjmNQIiI7Di5v6ba5V9VFsSusnnc36IyaHtbKI3eHuNZcV1WF87HVNyR1T joqq2S15yN7Fq/SfkDCVtInH//DEnfMueHzAbIf+a6Qq27BzTtSPrASX5yYwXVPNhAxe +5Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=uAmD+cLKEDeaQ5sIIegoK01hcED8wf+eyuSy31R7770=; b=ehcxpKvq0wBrAX02+zmoB9aBTsLyII5J90/P14xIU2KO0oNj9EubLIHx5uM6LCsvZ4 DTXNxh4R6ak7sRBkXYXtwiVC80vuKsvX1rmoK7Mxp6K/uF2OtGzT1Ps6uMwT9aaSQEiK Is/3DJ0hKDDjRIuqTiCbb6flCx4ebUFyer845AVR4dCSWPXDhuQ25DvuaWXZM9+7cNpu 40FmBIVwYmJXjerHJoRYuz5Wf0eR4aLlNS/JfFreperRw6g2rDq2TSLhOL1GnPYhngeg dYIUo0i/UEu1RHjQ4pO7TnnN3EMzr4NwyRflRx3YoVkZRaz3qDRQaJmAbjtUdbwgSUae vdGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=ENANPwQA; 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=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i198si5862987oib.111.2020.01.13.02.06.09; Mon, 13 Jan 2020 02:06:21 -0800 (PST) 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=@st.com header.s=STMicroelectronics header.b=ENANPwQA; 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=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727014AbgAMKFR (ORCPT + 99 others); Mon, 13 Jan 2020 05:05:17 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:60112 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725978AbgAMKFQ (ORCPT ); Mon, 13 Jan 2020 05:05:16 -0500 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00DA4Y0d020212; Mon, 13 Jan 2020 11:04:54 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=STMicroelectronics; bh=uAmD+cLKEDeaQ5sIIegoK01hcED8wf+eyuSy31R7770=; b=ENANPwQAAJvqiLBkWg+qrgjJhKC2mHUcF5Ukx3zedKUd/OtoDeORtma6EtqoqAIz72AS R4tVkLPoyfVvKezPUqXxD1ImPSytdHDBXWXOzr5wEt3rUzgStBJSEOekhHaoJWFgDGWN bpniChCPxN9Tkm5+ulZiIGQ7ypTaNKRvmL5oQPtqpVoANXJSkVQPz9DYJLsRu+LHBqF8 6uMrV6LQNxxRqjY56zyuuFOPZagB13tqiG65LqAVbLsaznFZqRs8a5vGpOHz4UOPfYz1 /o/LzrJb8Z7naNVVq8P0asDDc9aSKfgXUxBBuj3mHxMXlbLn8anDCES+AO2sxji4jHft 6A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2xf77aqk5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jan 2020 11:04:54 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C000510003B; Mon, 13 Jan 2020 11:04:53 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 943DB2A896E; Mon, 13 Jan 2020 11:04:53 +0100 (CET) Received: from localhost (10.75.127.44) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 13 Jan 2020 11:04:53 +0100 From: Arnaud Pouliquen To: , Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai CC: , , , Olivier Moysan , Subject: [PATCH v2] asoc: sti: fix possible sleep-in-atomic Date: Mon, 13 Jan 2020 11:04:00 +0100 Message-ID: <20200113100400.30472-1-arnaud.pouliquen@st.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG7NODE3.st.com (10.75.127.21) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-13_02:2020-01-13,2020-01-13 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change mutex and spinlock management to avoid sleep in atomic issue. Signed-off-by: Arnaud Pouliquen --- V1 to V2 suppress unexpected [INTERNAL REVIEW] tag in subject sound/soc/sti/uniperif_player.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c index 48ea915b24ba..2ed92c990b97 100644 --- a/sound/soc/sti/uniperif_player.c +++ b/sound/soc/sti/uniperif_player.c @@ -226,7 +226,6 @@ static void uni_player_set_channel_status(struct uniperif *player, * sampling frequency. If no sample rate is already specified, then * set one. */ - mutex_lock(&player->ctrl_lock); if (runtime) { switch (runtime->rate) { case 22050: @@ -303,7 +302,6 @@ static void uni_player_set_channel_status(struct uniperif *player, player->stream_settings.iec958.status[3 + (n * 4)] << 24; SET_UNIPERIF_CHANNEL_STA_REGN(player, n, status); } - mutex_unlock(&player->ctrl_lock); /* Update the channel status */ if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) @@ -365,8 +363,10 @@ static int uni_player_prepare_iec958(struct uniperif *player, SET_UNIPERIF_CTRL_ZERO_STUFF_HW(player); + mutex_lock(&player->ctrl_lock); /* Update the channel status */ uni_player_set_channel_status(player, runtime); + mutex_unlock(&player->ctrl_lock); /* Clear the user validity user bits */ SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(player, 0); @@ -598,7 +598,6 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol, iec958->status[1] = ucontrol->value.iec958.status[1]; iec958->status[2] = ucontrol->value.iec958.status[2]; iec958->status[3] = ucontrol->value.iec958.status[3]; - mutex_unlock(&player->ctrl_lock); spin_lock_irqsave(&player->irq_lock, flags); if (player->substream && player->substream->runtime) @@ -608,6 +607,8 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol, uni_player_set_channel_status(player, NULL); spin_unlock_irqrestore(&player->irq_lock, flags); + mutex_unlock(&player->ctrl_lock); + return 0; } -- 2.17.1