From patchwork Fri Sep 16 16:02:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 76405 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp570510qgf; Fri, 16 Sep 2016 09:03:23 -0700 (PDT) X-Received: by 10.66.254.102 with SMTP id ah6mr24214846pad.59.1474041803887; Fri, 16 Sep 2016 09:03:23 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a73si7886530pfc.20.2016.09.16.09.03.23; Fri, 16 Sep 2016 09:03:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964966AbcIPQDP (ORCPT + 4 others); Fri, 16 Sep 2016 12:03:15 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:34936 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964932AbcIPQDG (ORCPT ); Fri, 16 Sep 2016 12:03:06 -0400 Received: by mail-wm0-f44.google.com with SMTP id l132so45721906wmf.0 for ; Fri, 16 Sep 2016 09:03:05 -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; bh=jYObG7A1duxL+TfSQnl6CzEUpSUklhvan/s/lzbOKcE=; b=IYTFykWNgDn8Uw/ijBRxH6bhl8ubqCVcDMvC5FB1OAoCQa46W8Bz+6sL4jgIut9uB3 /JRB8NpnsMqCQxRIpWQsKIcIdpFjnzeuSKDa6ZG18c2djdMGGRDngQRWtzb+ehk1D+VW xcR8ZPU0Aic1zwBV0tCN1MZmnTHby7ZQETT2CwTgWQXwI/yKqILQtrHwFsH2rQqru0NU ddV/FOG8Aos3Z51O0aANrQSi++EhAR3jAc5ySYsnloUwT80yU7A4GtkmAJXUdX4pCCzv nkuyoCoTk4KwNlqQ0Fet9LqGNIf9GJhD37p4fnICE4hmXLp9dantSwvb2JZ4jw9AvQb2 VA7A== 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=jYObG7A1duxL+TfSQnl6CzEUpSUklhvan/s/lzbOKcE=; b=kCeG51AxSQraQMMuH+VsluS7hgGEiN1szZh7Yyrmwy+RgU/Cx2lZQNkgcALvw30DBl G0QFz6jesUPExI/YbnWzdqnxi0PjqsMmk1jkHqDLrqMQ0X7C/FFo8rEApp/BgEk7EYZD cjf6fqUjqLGsBBp0RoWHqakX+30X1b8DMhg+6zbAPbXnrZoqcgZ4afyLgp5asHPDs00x mRJWs8gMTZedYO8tFogYP1TmkFkSRBdgZ/8gOCbQe4kR8rAJxoY58hSgRoLOm3pN6XBO 6BSD5huo4cSjJDBs4UnG0+KoGiBd27qCYzoT9j15jtu263kedZSp2rqxHBeqM2PWkd06 9r+w== X-Gm-Message-State: AE9vXwPoFlz35ddG1onQlrdw272EMohJm8xkfJkENnlD5LoccBiCG+Rgn1UoZhEv3sLZOVV5 X-Received: by 10.28.8.84 with SMTP id 81mr9035214wmi.22.1474041784028; Fri, 16 Sep 2016 09:03:04 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id ub8sm9033421wjc.39.2016.09.16.09.03.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Sep 2016 09:03:03 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Alexandre Courbot , Andy Shevchenko , Vignesh R , Yong Li , Geert Uytterhoeven , Peter Zijlstra , Ingo Molnar , Wolfram Sang , Peter Rosin Cc: linux-i2c , linux-gpio , LKML , Bartosz Golaszewski Subject: [PATCH v2 3/4] i2c: add a warning to i2c_adapter_depth() Date: Fri, 16 Sep 2016 18:02:44 +0200 Message-Id: <1474041765-17818-4-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1474041765-17818-1-git-send-email-bgolaszewski@baylibre.com> References: <1474041765-17818-1-git-send-email-bgolaszewski@baylibre.com> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This routine is only used together with lockdep for nested locking. The number of lock subclasses is limited to 8 as defined in lockdep.h Emit a warning if the adapter depth exceeds the maximum number of lockdep subclasses. Signed-off-by: Bartosz Golaszewski --- drivers/i2c/i2c-core.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index c9b8df8..75cefa8 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1342,6 +1342,9 @@ unsigned int i2c_adapter_depth(struct i2c_adapter *adapter) while ((adapter = i2c_parent_is_i2c_adapter(adapter))) depth++; + WARN_ONCE(depth >= MAX_LOCKDEP_SUBCLASSES, + "adapter depth exceeds lockdep subclass limit\n"); + return depth; } EXPORT_SYMBOL_GPL(i2c_adapter_depth);