Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp168343ybg; Sun, 31 May 2020 20:48:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6Gt7Y4Y8PjbnghlqQxYTOfi2CXxOEeMEh2JVByJmoEtsUl+/8204SWov/K7vtr2Xmgvff X-Received: by 2002:a17:906:6b18:: with SMTP id q24mr6705772ejr.202.1590983303005; Sun, 31 May 2020 20:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590983303; cv=none; d=google.com; s=arc-20160816; b=w8d2H+e017wqCgPWYUQHQsnkO2IKRcX2ipJOMZj76gt4a3g4VnSLOdx4iFdlz3zMhd 0LamWsI8OmZxVU272/itZnoT0CXSH7G4pgMMgwkNnmYwMbmFm0iw39c3zEjRBv/ao/K+ wdH478ks3aVF2fpPeOQuyN6tQ2r5Y8E8QX1gFIV5l642fp1lWLgrjgC5eWqTAF+mWNwv QwnvOp8BDdVF91jHsLmso3d+2sUM9itUzS0GVocIDHiVVR8dQdXTnzjgP3l8EfS0YP+P k51UBTlLJGIe1toBFrBWJsbFvM3nQs/yZK1XO2m+jiz+f/zV6QFaU14EPmx4GmvKZg/s xGpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:content-transfer-encoding :mime-version:subject:from:message-id:date:dkim-signature; bh=VqMmePl86zsy1Dk5r+2rm3DdR8OVO/rUOynIQYNVyfg=; b=d3L6ji3rFZ1PUn9HndoM/XS2fwDoZefypzjdYP3/H/3PIfQeUpim5UZLBHrFN4GWeY slKMJMPF5m5SaY9KRCCsuX2Vct13Ckk5RXnV6CogkYXzdNeJ4MJsFvcLHsYs8I8ipAaQ kyc0DWTB3D7qzuX66T0fhk5Gwa/PzQTLLU7OF7wYmMIrF+5cPWVg5J/W5/8IDfO9rSRS XFhFoAr+wT/o+CKMEYBnCd1Tv2lWgPkkSmqaSvt2YqIrRXVZ2AOYCGLrcYuayjr4FkB9 qE8AeTf8AgE/G5o/6GpMhaX+wbwYIcaVFIaPZ67U4MugXfppdOfTugypSI88KjsXlQxh tCsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=o7DdYqEd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si2285933edl.255.2020.05.31.20.48.00; Sun, 31 May 2020 20:48:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=o7DdYqEd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727104AbgFADpz (ORCPT + 99 others); Sun, 31 May 2020 23:45:55 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:12612 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726002AbgFADpz (ORCPT ); Sun, 31 May 2020 23:45:55 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 49b1Kn0gCmz5Y; Mon, 1 Jun 2020 05:45:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1590983152; bh=pndK1FjAmFq0047oc3zSn4GkaXw9CpwjFxLaj77UgdE=; h=Date:From:Subject:To:Cc:From; b=o7DdYqEd4GUixVvSOrNrzZ2bHeU3/zAx4a9D11aQnZZdwYuQbIz69ifVRrCznbUKj GedeU9z/s5zMyfk+UQ0FpH53JtIh6ATUEHh8TryM6us92ncaETH0PyrYpKCha03ywH EGSA7CrnlsjT13sq+eNEMyoZXBIkj1pqeugPUkArTNcj1OvYdmxgPlwzilJ+X/lN6I PC6vabPd48+S+TqkluikcHeRakVoLhu37DOWiJs4MpK22/XiBmd2TSNXuQME9llTna KqW4Sf2hx94O2qh1OxmFEAr8CXF1JfnuvG1zRQA2Dn6TgfxDbh76o3KCbGgXgV0Hh0 M/tYiCqtqeRYQ== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at mail Date: Mon, 01 Jun 2020 05:45:48 +0200 Message-Id: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH] misc: atmel-ssc: lock with mutex instead of spinlock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: Nicolas Ferre , Arnd Bergmann , Greg Kroah-Hartman , Alexandre Belloni , Ludovic Desroches Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Uninterruptible context is not needed in the driver and causes lockdep warning because of mutex taken in of_alias_get_id(). Convert the lock to mutex to avoid the issue. Cc: stable@vger.kernel.org Signed-off-by: Michał Mirosław --- drivers/misc/atmel-ssc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index 1322e29bc37a..5cc032097476 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -20,7 +20,7 @@ #include "../../sound/soc/atmel/atmel_ssc_dai.h" /* Serialize access to ssc_list and user count */ -static DEFINE_SPINLOCK(user_lock); +static DEFINE_MUTEX(user_lock); static LIST_HEAD(ssc_list); struct ssc_device *ssc_request(unsigned int ssc_num) @@ -28,7 +28,7 @@ struct ssc_device *ssc_request(unsigned int ssc_num) int ssc_valid = 0; struct ssc_device *ssc; - spin_lock(&user_lock); + mutex_lock(&user_lock); list_for_each_entry(ssc, &ssc_list, list) { if (ssc->pdev->dev.of_node) { if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc") @@ -44,18 +44,18 @@ struct ssc_device *ssc_request(unsigned int ssc_num) } if (!ssc_valid) { - spin_unlock(&user_lock); + mutex_unlock(&user_lock); pr_err("ssc: ssc%d platform device is missing\n", ssc_num); return ERR_PTR(-ENODEV); } if (ssc->user) { - spin_unlock(&user_lock); + mutex_unlock(&user_lock); dev_dbg(&ssc->pdev->dev, "module busy\n"); return ERR_PTR(-EBUSY); } ssc->user++; - spin_unlock(&user_lock); + mutex_unlock(&user_lock); clk_prepare(ssc->clk); @@ -67,14 +67,14 @@ void ssc_free(struct ssc_device *ssc) { bool disable_clk = true; - spin_lock(&user_lock); + mutex_lock(&user_lock); if (ssc->user) ssc->user--; else { disable_clk = false; dev_dbg(&ssc->pdev->dev, "device already free\n"); } - spin_unlock(&user_lock); + mutex_unlock(&user_lock); if (disable_clk) clk_unprepare(ssc->clk); @@ -246,9 +246,9 @@ static int ssc_probe(struct platform_device *pdev) return -ENXIO; } - spin_lock(&user_lock); + mutex_lock(&user_lock); list_add_tail(&ssc->list, &ssc_list); - spin_unlock(&user_lock); + mutex_unlock(&user_lock); platform_set_drvdata(pdev, ssc); @@ -267,9 +267,9 @@ static int ssc_remove(struct platform_device *pdev) ssc_sound_dai_remove(ssc); - spin_lock(&user_lock); + mutex_lock(&user_lock); list_del(&ssc->list); - spin_unlock(&user_lock); + mutex_unlock(&user_lock); return 0; } -- 2.20.1