From patchwork Thu Jul 31 12:07:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 34591 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6B2FF20792 for ; Thu, 31 Jul 2014 12:08:06 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id 10sf1726886lbg.10 for ; Thu, 31 Jul 2014 05:08:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:date :message-id:subject:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=YGWPAidP5dbAiLsGh9ZUxSzZ2xIRIETxhAKpDWZg5Rw=; b=a49mNq9ZsV7w9/mcGXhnSTYD7oIj9dkMdjpiGDh2MWoF8lPkFJ76zmKPTwB41UZxec dKOjPspqwag9ommrU5sizVx0FQTm6RUqp4PuWCr7CJ9S+kRbO+7JRl+blohr7Dy1Ps6U 4rbker2fXM7mYLaL7JYzRQk1oWjRz+pxSh9GXBeugnu+sPU8Vv5kx1+9CJN1WoJW3//j t8ZKZ0JOAoPP9nHLID2SZb1U2nhgeDYmoW0cr5nEmTPaJdUeejWqU/G9ZY6X2BYmUZI4 cQt04l6UK2NoRmdaFdHhPHpama43Zk7V6cSn1XViRfCZofxG7Gbiop55yiTT+VjbeEAj 20yA== X-Gm-Message-State: ALoCoQmjQvlSvrr7Hfgc4z0YoCGWY4PG67f/N4aUXOEqB6MVZFERDFXM0g341xqBz4Ccl2ECdB6+ X-Received: by 10.180.12.35 with SMTP id v3mr1074342wib.3.1406808484371; Thu, 31 Jul 2014 05:08:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.68 with SMTP id h62ls882983qge.52.gmail; Thu, 31 Jul 2014 05:08:04 -0700 (PDT) X-Received: by 10.220.68.140 with SMTP id v12mr11968504vci.13.1406808484192; Thu, 31 Jul 2014 05:08:04 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id jp10si4156079vdb.9.2014.07.31.05.08.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jul 2014 05:08:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ik5so3983956vcb.34 for ; Thu, 31 Jul 2014 05:08:04 -0700 (PDT) X-Received: by 10.220.131.207 with SMTP id y15mr1460209vcs.71.1406808484121; Thu, 31 Jul 2014 05:08:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp12771vcb; Thu, 31 Jul 2014 05:08:03 -0700 (PDT) X-Received: by 10.68.162.100 with SMTP id xz4mr3718503pbb.120.1406808483160; Thu, 31 Jul 2014 05:08:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bk6si2853913pdb.368.2014.07.31.05.08.02 for ; Thu, 31 Jul 2014 05:08:03 -0700 (PDT) Received-SPF: none (google.com: linux-gpio-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750978AbaGaMIB (ORCPT + 1 other); Thu, 31 Jul 2014 08:08:01 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:37429 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbaGaMIA (ORCPT ); Thu, 31 Jul 2014 08:08:00 -0400 Received: from cpc11-sgyl31-2-0-cust672.sgyl.cable.virginm.net ([94.175.94.161] helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XCp9G-0004Lp-1X; Thu, 31 Jul 2014 12:07:58 +0000 Received: from broonie by debutante with local (Exim 4.83) (envelope-from ) id 1XCp9D-0003HA-7X; Thu, 31 Jul 2014 13:07:51 +0100 From: Mark Brown To: Linus Walleij , Alexandre Courbot Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, Mark Brown Date: Thu, 31 Jul 2014 13:07:48 +0100 Message-Id: <1406808468-12559-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.0.1 X-SA-Exim-Connect-IP: 94.175.94.161 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Subject: [PATCH] gpiolib: Don't allow drivers to specify a base with DT X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-gpio-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-gpio@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: broonie@kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mark Brown DT based systems should have no reason to use fixed GPIO numbers but some drivers that work on both DT and non-DT platforms specify them anyway. In order to improve robustness in cases where drivers use gpio_is_valid() to check for a valid GPIO on data initialized to zero as a default and avoid bugs due to assuptions about fixed numbers creeping in ignore any specified base when DT is in use. Signed-off-by: Mark Brown --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 768f0831db18..11d3cf1cbca7 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -234,7 +234,7 @@ int gpiochip_add(struct gpio_chip *chip) spin_lock_irqsave(&gpio_lock, flags); - if (base < 0) { + if (base < 0 || of_have_populated_dt()) { base = gpiochip_find_base(chip->ngpio); if (base < 0) { status = base;