linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linaro-kernel@lists.linaro.org, Mark Brown <broonie@linaro.org>
Subject: [PATCH] gpiolib: Don't allow drivers to specify a base with DT
Date: Thu, 31 Jul 2014 13:07:48 +0100	[thread overview]
Message-ID: <1406808468-12559-1-git-send-email-broonie@kernel.org> (raw)

From: Mark Brown <broonie@linaro.org>

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 <broonie@linaro.org>
---
 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;
-- 
2.0.1


             reply	other threads:[~2014-07-31 12:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31 12:07 Mark Brown [this message]
2014-08-04  4:21 ` [PATCH] gpiolib: Don't allow drivers to specify a base with DT Alexandre Courbot
2014-08-11 12:38   ` Mark Brown
2014-08-11  7:26 ` Linus Walleij
2014-08-11 12:31   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406808468-12559-1-git-send-email-broonie@kernel.org \
    --to=broonie@kernel.org \
    --cc=broonie@linaro.org \
    --cc=gnurou@gmail.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).