From patchwork Wed Jun 3 15:53:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oder Chiou X-Patchwork-Id: 6539421 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 169FCC0020 for ; Wed, 3 Jun 2015 15:54:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 16E0A20643 for ; Wed, 3 Jun 2015 15:54:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9C62E20625 for ; Wed, 3 Jun 2015 15:54:01 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 185EB265AF9; Wed, 3 Jun 2015 17:54:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 51EB7265AE7; Wed, 3 Jun 2015 17:53:58 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C0EFD265AE7; Wed, 3 Jun 2015 17:53:56 +0200 (CEST) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [60.250.210.242]) by alsa0.perex.cz (Postfix) with ESMTP id A4A03265AF3 for ; Wed, 3 Jun 2015 17:53:40 +0200 (CEST) Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.54 with qID t53FrXjR023797, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcas11.realtek.com.tw[172.21.6.12]) by rtits2.realtek.com.tw (8.14.9/2.40/5.66) with ESMTP id t53FrXjR023797 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 3 Jun 2015 23:53:34 +0800 Received: from localhost.localdomain (222.103.89.97) by RTITCAS11.realtek.com.tw (172.21.6.12) with Microsoft SMTP Server id 14.3.210.2; Wed, 3 Jun 2015 23:53:34 +0800 From: Oder Chiou To: , Date: Wed, 3 Jun 2015 23:53:17 +0800 Message-ID: <1433346797-1908-1-git-send-email-oder_chiou@realtek.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [222.103.89.97] Cc: Oder Chiou , bardliao@realtek.com, alsa-devel@alsa-project.org, john.lin@realtek.com, flove@realtek.com Subject: [alsa-devel] [PATCH] ASoC: rt5677: Avoid recursive locking in the DEADLOCK detector X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The patch is for to avoid recursive locking in the DEADLOCK detector. In the driver, it encountered the warnning message of the recursive locking in the function "regmap_lock_mutex". Signed-off-by: Oder Chiou --- sound/soc/codecs/rt5677.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 31d969a..ee5b570 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -4998,6 +4998,22 @@ static const struct regmap_config rt5677_regmap_physical = { .num_ranges = ARRAY_SIZE(rt5677_ranges), }; +static void rt5677_regmap_lock_mutex(void *__lock) +{ + struct mutex *lock = __lock; + + mutex_lock(lock); +} + +static void rt5677_regmap_unlock_mutex(void *__lock) +{ + struct mutex *lock = __lock; + + mutex_unlock(lock); +} + +static struct mutex rt5677_regmap_lock; + static const struct regmap_config rt5677_regmap = { .reg_bits = 8, .val_bits = 16, @@ -5009,6 +5025,9 @@ static const struct regmap_config rt5677_regmap = { .readable_reg = rt5677_readable_register, .reg_read = rt5677_read, .reg_write = rt5677_write, + .lock = rt5677_regmap_lock_mutex, + .unlock = rt5677_regmap_unlock_mutex, + .lock_arg = &rt5677_regmap_lock, .cache_type = REGCACHE_RBTREE, .reg_defaults = rt5677_reg, @@ -5206,6 +5225,8 @@ static int rt5677_i2c_probe(struct i2c_client *i2c, return ret; } + mutex_init(&rt5677_regmap_lock); + regmap_read(rt5677->regmap, RT5677_VENDOR_ID2, &val); if (val != RT5677_DEVICE_ID) { dev_err(&i2c->dev,