From patchwork Fri Sep 16 16:02:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 76404 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp570379qgf; Fri, 16 Sep 2016 09:03:08 -0700 (PDT) X-Received: by 10.98.62.194 with SMTP id y63mr23937047pfj.99.1474041788910; Fri, 16 Sep 2016 09:03:08 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q65si6499472pfk.284.2016.09.16.09.03.08; Fri, 16 Sep 2016 09:03:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-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-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964954AbcIPQDH (ORCPT + 1 other); Fri, 16 Sep 2016 12:03:07 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:36461 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935589AbcIPQDD (ORCPT ); Fri, 16 Sep 2016 12:03:03 -0400 Received: by mail-wm0-f49.google.com with SMTP id b187so44694526wme.1 for ; Fri, 16 Sep 2016 09:03:02 -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=Ny+QFfwesh6FAkG6rV89szchz+57JlrUq2nqtXHSBgc=; b=u1KbEXdKfpwlRizI8LjIF0yKeTzxXhT07YeWoCxabELIsAvAIp3ZL+YlRvbU74SvRI Tb/vUgz4TJIrkI6icTzT71+W+mlSOMKrlDzJ8JKFrFzlUCjKl49PIJB6WGnCqLdry2rO 7wrP37gGuUIIrqwbxytC3J4wWNxd5ZYJiiLERv/pDFslk34BL4U+tnUsPBSyvnaysrdW IV9fEeRRucVLWeSttoPUZY2fz+8ShTT/thxyKbr/QjlW+1T2NhuO6eIkcVtKZeI6fFNM WxPLMBP7oAhJSK7UmHaCWirg3XGCP/zHgm5FtcHdg7QJW8r0g25aIDYxit7GMriF7J6h Ewjw== 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=Ny+QFfwesh6FAkG6rV89szchz+57JlrUq2nqtXHSBgc=; b=QyQajrsOhe0gujARZ0tZHBz9qDzTac8KIFeXMnDHgZJDu0X2I8I3tES7dhXbqIf/p3 9y7QKx0oexlGz6boUJNj0GNt6o38xqCjb49HQndomoaEKm7Gz8ga7bY1pO+xd5fPmMJI DszUlZcVFPlTkeJTvfuWlT1Hm2RYYASL/DV7+eivTW/dx+XeplatzGMvI1rAP2FCheDk ddShfh41YC4fVCu/dLi3jnaMSMnsK9vSEZDQUTA619ZL8bxWD2D2WYlw4TMVH8mwQzoL +BY/DNwg0WJvCDrq/RZk9TIJb1C3796OruPKmSfepQ+jo2HVYdnSCAnQceE6pfjXPks5 /09g== X-Gm-Message-State: AE9vXwPiVVQOUiYVF57zeCqdFP1/xxQGz6irRUbJgP7fjEsbhtrjm1S+cT4zS7ptn2W582EQ X-Received: by 10.194.96.136 with SMTP id ds8mr13288027wjb.3.1474041781840; Fri, 16 Sep 2016 09:03:01 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id ub8sm9033421wjc.39.2016.09.16.09.03.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Sep 2016 09:03:01 -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 1/4] i2c: export i2c_adapter_depth() Date: Fri, 16 Sep 2016 18:02:42 +0200 Message-Id: <1474041765-17818-2-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-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org For crazy setups in which an i2c gpio expander is behind an i2c gpio multiplexer controlled by a gpio provided a second expander using the same device driver we need to explicitly tell lockdep how to handle nested locking. Export i2c_adapter_depth() as public API to be reused outside of i2c core code. Signed-off-by: Bartosz Golaszewski --- drivers/i2c/i2c-core.c | 9 ++------- include/linux/i2c.h | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" 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 da3a02e..c9b8df8 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1335,13 +1335,7 @@ static void i2c_adapter_dev_release(struct device *dev) complete(&adap->dev_released); } -/* - * This function is only needed for mutex_lock_nested, so it is never - * called unless locking correctness checking is enabled. Thus we - * make it inline to avoid a compiler warning. That's what gcc ends up - * doing anyway. - */ -static inline unsigned int i2c_adapter_depth(struct i2c_adapter *adapter) +unsigned int i2c_adapter_depth(struct i2c_adapter *adapter) { unsigned int depth = 0; @@ -1350,6 +1344,7 @@ static inline unsigned int i2c_adapter_depth(struct i2c_adapter *adapter) return depth; } +EXPORT_SYMBOL_GPL(i2c_adapter_depth); /* * Let users instantiate I2C devices through sysfs. This can be used when diff --git a/include/linux/i2c.h b/include/linux/i2c.h index fffdc27..cfacc03 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -673,6 +673,7 @@ extern void i2c_clients_command(struct i2c_adapter *adap, extern struct i2c_adapter *i2c_get_adapter(int nr); extern void i2c_put_adapter(struct i2c_adapter *adap); +extern unsigned int i2c_adapter_depth(struct i2c_adapter *adapter); void i2c_parse_fw_timings(struct device *dev, struct i2c_timings *t, bool use_defaults);