From patchwork Wed Oct 23 06:36:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 3086141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D222B9F372 for ; Wed, 23 Oct 2013 06:36:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7BE120258 for ; Wed, 23 Oct 2013 06:36:51 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E009920240 for ; Wed, 23 Oct 2013 06:36:50 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYs3k-0000bh-3q; Wed, 23 Oct 2013 06:36:48 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYs3h-0004yz-NH; Wed, 23 Oct 2013 06:36:45 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYs3f-0004yf-3L for linux-arm-kernel@lists.infradead.org; Wed, 23 Oct 2013 06:36:43 +0000 Received: by mail-pa0-f54.google.com with SMTP id kx10so656266pab.41 for ; Tue, 22 Oct 2013 23:36:20 -0700 (PDT) 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; bh=KFUA2ttTBZmlrKcAJDNskriRNxzR+8zHHntE6WABQBs=; b=Nl6YA2D/+Wk6AeAdwA3/ejme9ko7xmLKyudd6TLbAYLhI4B25u/aBOctmqOTvV5RJJ F9szMRSAq1QjyCo/SJmwsq1oAV1d4OuuBFCs5NC7thqeuDAQQ9pFjzmrRqVN5qbHbdj+ NaKOHNpbMkfI2bqWOVRUvTGXjm9SoHsFFvDsFKqUd1f9Dt8Yuif98DPPaA143zgnEgdh X0U8CZo60Lr1ol7lLMWwByOLIpHTnDeEoOFEHanqGraWNM2B6qXlamlV6pZRkU53ieQ0 P8Pmh27EYGapamN5Bxew5hd5vpw6OiApK8WkWJjMQh/9iJCU8j8pRVGK5WCIm883kbWf e3ng== X-Gm-Message-State: ALoCoQlfwwQg3KrwE/5mQt7Uano6O58J1/vsRkN43A20+pOT91KLbODiPLH4HSIpHHLRhFhalK7d X-Received: by 10.66.65.134 with SMTP id x6mr1635959pas.142.1382510180616; Tue, 22 Oct 2013 23:36:20 -0700 (PDT) Received: from localhost.localdomain ([27.115.121.40]) by mx.google.com with ESMTPSA id iu7sm2143500pbc.45.2013.10.22.23.36.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Oct 2013 23:36:19 -0700 (PDT) From: Haojian Zhuang To: linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Subject: [PATCH] gpio: pl061: hook request if gpio-ranges avaiable Date: Wed, 23 Oct 2013 14:36:11 +0800 Message-Id: <1382510171-5937-1-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.8.1.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131023_023643_213447_C0E90959 X-CRM114-Status: GOOD ( 10.56 ) X-Spam-Score: -2.6 (--) Cc: Haojian Zhuang , patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gpio-ranges property could binds gpio to pinctrl. But there may be some gpios without pinctrl operation. So check whether gpio-ranges property exists in device node first. Signed-off-by: Haojian Zhuang --- drivers/gpio/gpio-pl061.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index cb5510b..44a0ba1 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -306,8 +306,11 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) spin_lock_init(&chip->lock); - chip->gc.request = pl061_gpio_request; - chip->gc.free = pl061_gpio_free; + /* Hook the request()/free() for pinctrl operation */ + if (of_get_property(dev->of_node, "gpio-ranges", NULL)) { + chip->gc.request = pl061_gpio_request; + chip->gc.free = pl061_gpio_free; + } chip->gc.direction_input = pl061_direction_input; chip->gc.direction_output = pl061_direction_output; chip->gc.get = pl061_get_value;