From patchwork Wed Oct 23 16:12:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 177324 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp938626ill; Wed, 23 Oct 2019 09:12:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0DZlWtucHhIHel5xZdF6hQ+gsldz/kmapcPbmluLjXBxuRz9O9HG6N1vSHh4Pv3lVe80o X-Received: by 2002:a05:6402:1255:: with SMTP id l21mr25091437edw.41.1571847138431; Wed, 23 Oct 2019 09:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571847138; cv=none; d=google.com; s=arc-20160816; b=W7y5yx8m59da7tvZ6bH/U4n6Y1W0mqROO8Gf7dg28wLGHFJsi7VKg5hWCjN6LOBSa5 Ma6dwtF8FdBaASTrTUlB0p13UjE8Zzu2602AlVHwz2H4XZp4/y6Q+vqOAV+VtJIm1yky 1njQVmF6wLfTTCL8XRuxtp8k9JwrFKCkx1YkWc2s7b3CWIiHSjPC33i/TnHtL2vpVD/E LZgjJHZall0j+s+GqkSYMct4M/CnKdni52IDD/9cO1TJTTFvonEbgNbAIjSMZyEOonrP zC9KnZEGT0VV/HKFlbPJG37xvgOV/sQo7KFzmRLocHDyd+M0wDKwRm6v07n/ghAGuwDt io4g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=94Fa0onmL8QGae72SEYXHjiLUCmbUKrPJtMdClFuS2o=; b=AnCgTgGP9yvinFYET3nb1808seq7XrioXflioz+HriUr4dmLR8LaA4WRqpyGXXGnnv WZZOGvt3gvplFGlJTuf3oCImMDvXEY2YOVgzyKakBPUnwWxx5HTCkEUXjmuRYpbwjgU4 fm9cSLMDauMpvjGiBUcV9+tPHyYyVGHIHCXyUpGCTENVRGrcWXf8lQPWMznhUvc/3viQ VzGqqDnvhXTDyHlRdMBb35jdeXyqO21aaRJ8BTGHE9+W9Knmj3PLvKb8GLiUQiRoEiLf LyzVaDhvFfM24Z9hHcJj6iqr2OSB6/x4nHypAYtz3g2pU62/4m/zdenf2imskzzhjh+N eXeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=gMwNNbwH; 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 y47si14989613edd.236.2019.10.23.09.12.18; Wed, 23 Oct 2019 09:12:18 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=gMwNNbwH; 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 S2407080AbfJWQMO (ORCPT + 26 others); Wed, 23 Oct 2019 12:12:14 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54253 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404582AbfJWQMN (ORCPT ); Wed, 23 Oct 2019 12:12:13 -0400 Received: by mail-wm1-f67.google.com with SMTP id i13so6647259wmd.3 for ; Wed, 23 Oct 2019 09:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=94Fa0onmL8QGae72SEYXHjiLUCmbUKrPJtMdClFuS2o=; b=gMwNNbwHenujY7v/kJuQKntVQAWnsbgfL4M3WoHGC6pm2MKHeb8jdd5TIQPe7JlCEn uLskMNAA5vwIZaPVvT+qBK5AsvgbCLhqhL48s/ZapNXG9WwgIE+cc2XRKyithM4kw/jH Qruk2iiXGFqF20V1T4d/BOF0PgCnBhF3LJns6TBGWi1xj5grk+i1ooWWkhLoo5/Wz7pe 3XjE2ouDUWRZA+ta1vLrkivCI2ABovlbJFO1Qv/iAYAmM6JVdwkSIr8EteFdFU85B8Rl tpbxiXX4+Z0HHikclQzwKJ6xrA7NEGwogl85KmN9OWjh9q4Yzt2Zrl/LMmNPt7pI1evZ NPnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=94Fa0onmL8QGae72SEYXHjiLUCmbUKrPJtMdClFuS2o=; b=s5MDeRnEVy8N2tuwr68JzT0YJkHTHzsooOXMa0KtTMqRnXbK2kDpFc8DJfeE3hEb9f hZqIkovpUsO7e4mE+fBF011cnjzEaMjsd6jVe1GWlGBCj8QVsX5xTcYnSd0s3Ze+4Sy1 oNQ+5yqqdaPBl8dtG28mpWjPqAc52rmQ+RdZ/D5aIxd8S9igLge9fELEIy3/uzWf6tMX j7rtzZPFgujEoA89UN7mDNmw6nWzLkUgJT3qsFTTgE8N+jhKoDseMcSikP3ZBaN+KiRC H4PxNOJ5uqNjAZXMWXTvb/YA36oJJabkR3ZaT/e0Bikzalu479BN3tBW+Qvagl5W7we6 K72Q== X-Gm-Message-State: APjAAAWphIUW7aaUSKn7hkHkdspy51ZVLyRCI8vxOVqPDZMZAjVryiqW wk7+18Kknnmb67UAVi3gDYXFaQ== X-Received: by 2002:a1c:544e:: with SMTP id p14mr621282wmi.17.1571847132157; Wed, 23 Oct 2019 09:12:12 -0700 (PDT) Received: from starbuck.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id x7sm30240578wrg.63.2019.10.23.09.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 09:12:11 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Russell King Subject: [PATCH 1/2] Revert "ASoC: hdmi-codec: re-introduce mutex locking" Date: Wed, 23 Oct 2019 18:12:02 +0200 Message-Id: <20191023161203.28955-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191023161203.28955-1-jbrunet@baylibre.com> References: <20191023161203.28955-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit eb1ecadb7f67dde94ef0efd3ddaed5cb6c9a65ed. This fixes the following warning reported by lockdep and a potential issue with hibernation -- 2.21.0 ==================================== WARNING: pulseaudio/1297 still has locks held! 5.3.0+ #1826 Not tainted ------------------------------------ 1 lock held by pulseaudio/1297: #0: ee815308 (&hcp->lock){....}, at: hdmi_codec_startup+0x20/0x130 stack backtrace: CPU: 0 PID: 1297 Comm: pulseaudio Not tainted 5.3.0+ #1826 Hardware name: Marvell Dove (Cubox) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (futex_wait_queue_me+0x13c/0x19c) [] (futex_wait_queue_me) from [] (futex_wait+0x184/0x24c) [] (futex_wait) from [] (do_futex+0x334/0x598) [] (do_futex) from [] (sys_futex_time32+0x118/0x180) [] (sys_futex_time32) from [] (ret_fast_syscall+0x0/0x54) Exception stack(0xebd31fa8 to 0xebd31ff0) 1fa0: 00000000 ffffffff 000c8748 00000189 00000001 00000000 1fc0: 00000000 ffffffff 00000000 000000f0 00000000 00000000 00000000 00056200 1fe0: 000000f0 beac03a8 b6d6c835 b6d6f456 Fixes: eb1ecadb7f67 ("ASoC: hdmi-codec: re-introduce mutex locking") Reported-by: Russell King Signed-off-by: Jerome Brunet --- sound/soc/codecs/hdmi-codec.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index b5fd8f08726e..f8b5b960e597 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -274,7 +274,7 @@ struct hdmi_codec_priv { uint8_t eld[MAX_ELD_BYTES]; struct snd_pcm_chmap *chmap_info; unsigned int chmap_idx; - struct mutex lock; + unsigned long busy; struct snd_soc_jack *jack; unsigned int jack_status; }; @@ -390,8 +390,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 = mutex_trylock(&hcp->lock); - if (!ret) { + ret = test_and_set_bit(0, &hcp->busy); + if (ret) { dev_err(dai->dev, "Only one simultaneous stream supported!\n"); return -EINVAL; } @@ -419,7 +419,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, err: /* Release the exclusive lock on error */ - mutex_unlock(&hcp->lock); + clear_bit(0, &hcp->busy); return ret; } @@ -431,7 +431,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); - mutex_unlock(&hcp->lock); + clear_bit(0, &hcp->busy); } static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, @@ -811,8 +811,6 @@ 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;