From patchwork Thu Jun 25 09:35:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 6673011 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 78C5F9F1C1 for ; Thu, 25 Jun 2015 09:36:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8BF7520692 for ; Thu, 25 Jun 2015 09:36:57 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4219F2068A for ; Thu, 25 Jun 2015 09:36:56 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5B0CD260517; Thu, 25 Jun 2015 11:36:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id DC64E2604E1; Thu, 25 Jun 2015 11:36:35 +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 970DD26055C; Thu, 25 Jun 2015 11:36:34 +0200 (CEST) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by alsa0.perex.cz (Postfix) with ESMTP id AE2FA2604E1 for ; Thu, 25 Jun 2015 11:36:08 +0200 (CEST) Received: by pdbep18 with SMTP id ep18so28156139pdb.1 for ; Thu, 25 Jun 2015 02:36:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5DPlaCn7GxWZl3eQ2KkVaS8iTe+20aYSQLEcUoiV1TQ=; b=cVV7HfsCyZu6gyXYkOFjAjE6zXjyq7W2H+NIxAJLheB7Bpgr0iL4dQnKEnotNV5K54 Qi7mIUAvXbZYx3CFt4KAFCZI3m+vGzgi3hU3UBVWjs9F8f0JE1y8DUAoW/oXBG8oVg5O XvzsUkvR+qh6mNvRyrjDaPntHZSAJ82VXse3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5DPlaCn7GxWZl3eQ2KkVaS8iTe+20aYSQLEcUoiV1TQ=; b=mnr77ohgSfdtZOvW23iB8Qtqa4Mh/rqs6FJvL+ABjdcIinUz5iAABXLf8vIY5WWyuN DsxLCGihu5OQte8fLTUccqKL9pMhtJ/SFFHA6HlvAUAlMRT7IdFCHp41UCMaLHRYNmTb y1lyDarflAiOB8JkW4WrDA2b9I+YM8lsv6OqLGxrrLGoBratZ3JVYHv80S4Q7edwr9A2 lXiUA3nwjtwTFvdjti4hjMGzD6HOTtZhgr0Xk9t6fco9ZuYim6IUtoA3pI2DI/tP9qOl 3iLEroOj5EMHqOCG5ljhw0p0RNyEIjBQTUpm5ub9+k7CRSfHUUA9w0pnrqNaDUKWvxKM N3Tg== X-Gm-Message-State: ALoCoQlRKw9xnEmpny8x588E2/C4+KXU44OFff+oqi/7PNSFHPtRVyeLKC2nJ+5JOd7LIPAcRReN X-Received: by 10.66.146.226 with SMTP id tf2mr44112447pab.4.1435224967037; Thu, 25 Jun 2015 02:36:07 -0700 (PDT) Received: from drinkcat.tpe.corp.google.com ([172.30.210.53]) by mx.google.com with ESMTPSA id bp17sm22073602pdb.48.2015.06.25.02.36.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Jun 2015 02:36:06 -0700 (PDT) From: Nicolas Boichat To: Mark Brown Date: Thu, 25 Jun 2015 17:35:04 +0800 Message-Id: <1435224904-35517-2-git-send-email-drinkcat@chromium.org> X-Mailer: git-send-email 2.4.3.573.g4eafbef In-Reply-To: <1435224904-35517-1-git-send-email-drinkcat@chromium.org> References: <1435224904-35517-1-git-send-email-drinkcat@chromium.org> Cc: Oder Chiou , alsa-devel@alsa-project.org, Lars-Peter Clausen , Anatol Pomozov , Mauro Carvalho Chehab , Takashi Iwai , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Liam Girdwood , Antti Palosaari , Bard Liao , Arjan van de Ven , Ingo Molnar Subject: [alsa-devel] [RFC PATCH 2/2] ASoC: rt5677: Add lockdep class to silence lockdep warnings 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Accessing rt5677->regmap requires read/write operations on another regmap (rt5677->regmap_physical), which causes the lockdep detector to throw a false warning, as both regmaps are using the same lockdep class by default. Introduce a new class for rt5677->regmap to silence this warning. Sample warning: [ 2.569449] ============================================= [ 2.569451] [ INFO: possible recursive locking detected ] [ 2.569454] 3.18.0 #311 Tainted: G S [ 2.569456] --------------------------------------------- [ 2.569458] swapper/0/1 is trying to acquire lock: [ 2.569469] (&map->mutex){+.+...}, at: [] regmap_lock_mutex+0x10/0x18 [ 2.569470] [ 2.569470] but task is already holding lock: [ 2.569476] (&map->mutex){+.+...}, at: [] regmap_lock_mutex+0x10/0x18 [ 2.569478] [ 2.569478] other info that might help us debug this: [ 2.569479] Possible unsafe locking scenario: [ 2.569479] [ 2.569480] CPU0 [ 2.569481] ---- [ 2.569484] lock(&map->mutex); [ 2.569486] lock(&map->mutex); [ 2.569487] [ 2.569487] *** DEADLOCK *** [ 2.569487] [ 2.569489] May be due to missing lock nesting notation [ 2.569489] [ 2.569491] 3 locks held by swapper/0/1: [ 2.569499] #0: (&dev->mutex){......}, at: [] __driver_attach+0x38/0x98 [ 2.569505] #1: (&dev->mutex){......}, at: [] __driver_attach+0x58/0x98 [ 2.569512] #2: (&map->mutex){+.+...}, at: [] regmap_lock_mutex+0x10/0x18 [ 2.569513] [ 2.569513] stack backtrace: [ 2.569517] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G S 3.18.0 #311 [ 2.569521] Call trace: [ 2.569527] [] dump_backtrace+0x0/0x108 [ 2.569530] [] show_stack+0x10/0x1c [ 2.569535] [] dump_stack+0x74/0x94 [ 2.569540] [] __lock_acquire+0x73c/0x1910 [ 2.569544] [] lock_acquire+0xec/0x128 [ 2.569548] [] mutex_lock_nested+0x58/0x354 [ 2.569551] [] regmap_lock_mutex+0xc/0x18 [ 2.569554] [] regmap_read+0x34/0x68 [ 2.569559] [] rt5677_read+0x9c/0xb4 [ 2.569562] [] _regmap_read+0xa8/0x138 [ 2.569565] [] regmap_read+0x44/0x68 [ 2.569569] [] rt5677_i2c_probe+0x25c/0x4a4 [ 2.569574] [] i2c_device_probe+0xfc/0x130 [ 2.569577] [] driver_probe_device+0xd4/0x23c [ 2.569580] [] __driver_attach+0x68/0x98 [ 2.569584] [] bus_for_each_dev+0x70/0x90 [ 2.569588] [] driver_attach+0x1c/0x28 [ 2.569591] [] bus_add_driver+0xd8/0x1e0 [ 2.569594] [] driver_register+0xbc/0x10c [ 2.569598] [] i2c_register_driver+0x48/0xac [ 2.569601] [] rt5677_i2c_driver_init+0x14/0x20 [ 2.569605] [] do_one_initcall+0xf4/0x18c [ 2.569609] [] kernel_init_freeable+0x144/0x1e4 [ 2.569613] [] kernel_init+0x10/0xd4 Signed-off-by: Nicolas Boichat --- sound/soc/codecs/rt5677.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 31d969a..3007d13 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -4998,6 +4998,7 @@ static const struct regmap_config rt5677_regmap_physical = { .num_ranges = ARRAY_SIZE(rt5677_ranges), }; +static struct lock_class_key rt5677_regmap_key; static const struct regmap_config rt5677_regmap = { .reg_bits = 8, .val_bits = 16, @@ -5015,6 +5016,10 @@ static const struct regmap_config rt5677_regmap = { .num_reg_defaults = ARRAY_SIZE(rt5677_reg), .ranges = rt5677_ranges, .num_ranges = ARRAY_SIZE(rt5677_ranges), + + /* Silence incorrect lockdep warnings, as rt5677_regmap_physical is + * accessed from within rt5677_regmap. */ + .lockdep_lock_class_key = &rt5677_regmap_key, }; static const struct i2c_device_id rt5677_i2c_id[] = {