From patchwork Wed Jul 1 12:45:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 490125 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 164701402B0 for ; Wed, 1 Jul 2015 22:47:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=TC4Y/dyF; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754048AbbGAMrq (ORCPT ); Wed, 1 Jul 2015 08:47:46 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:34265 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbbGAMrf (ORCPT ); Wed, 1 Jul 2015 08:47:35 -0400 Received: by wiar9 with SMTP id r9so68190928wia.1; Wed, 01 Jul 2015 05:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=IxjAqOwFYfLZn9rHmwiLETK+/Vv6oKav1PfWlIOGbyA=; b=TC4Y/dyFvUAWn251iWv30WDERv3qs+QxT3Gaush8WGoNWjnrCC1bXgyGJzyhjJsgbX deexCBw+U7Oq8NCxSV6CZ4jgz3i8cEpybQtDhKx2QSGtZ+2Z5ltos1bcKEdqqYktxZ6q ug94ZV3PJ6zrlEcl3RL2Gmn76RGen8xMT46tfkykmkA48vVdPG1b2lfmcGJ5tF26yRu+ 2NvePQvmdtBbc1GvxuG/aJIYZyuDaMhvbyguuCxGyefvrtXV4+GjhcgIYDyqDL4FRLtZ SfrAwJz0HpHbbrwxBzy1tj/Ahh0Bw8vpjm619FZQzkPfKftZA3kLwCLH41zPpScDj9jf bKiw== X-Received: by 10.180.231.40 with SMTP id td8mr6407251wic.9.1435754853482; Wed, 01 Jul 2015 05:47:33 -0700 (PDT) Received: from cizrna.lan ([109.72.12.160]) by mx.google.com with ESMTPSA id s10sm2760081wjy.35.2015.07.01.05.47.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2015 05:47:32 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, Tomeu Vizoso , Thierry Reding , Linus Walleij , Stephen Warren , Alexandre Courbot Subject: [PATCH v1 2/3] pinctrl: tegra: Only set the gpio range if needed Date: Wed, 1 Jul 2015 14:45:52 +0200 Message-Id: <1435754753-31307-3-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1435754753-31307-1-git-send-email-tomeu.vizoso@collabora.com> References: <1435754753-31307-1-git-send-email-tomeu.vizoso@collabora.com> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org If the gpio DT node has the gpio-ranges property, the range will be added by the gpio core and doesn't need to be added by the pinctrl driver. By having the gpio-ranges property, we have an explicit dependency from the gpio node to the pinctrl node and we can stop using the deprecated pinctrl_add_gpio_range() function. Signed-off-by: Tomeu Vizoso --- drivers/pinctrl/pinctrl-tegra.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c index 0f982b8..0fd7fd2 100644 --- a/drivers/pinctrl/pinctrl-tegra.c +++ b/drivers/pinctrl/pinctrl-tegra.c @@ -624,6 +624,22 @@ static struct pinctrl_desc tegra_pinctrl_desc = { .owner = THIS_MODULE, }; +static bool gpio_node_has_range(void) +{ + struct device_node *np; + bool has_prop = false; + + np = of_find_compatible_node(NULL, NULL, "nvidia,tegra30-gpio"); + if (!np) + return has_prop; + + has_prop = of_find_property(np, "gpio-ranges", NULL); + + of_node_put(np); + + return has_prop; +} + int tegra_pinctrl_probe(struct platform_device *pdev, const struct tegra_pinctrl_soc_data *soc_data) { @@ -708,7 +724,8 @@ int tegra_pinctrl_probe(struct platform_device *pdev, return PTR_ERR(pmx->pctl); } - pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range); + if (!gpio_node_has_range()) + pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range); platform_set_drvdata(pdev, pmx);