[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAVeFuKv_Qd2u60zSYYKicahDcH1wKs2BVQRGhNsF9civT_S2g@mail.gmail.com>
Date: Mon, 4 Aug 2014 13:21:57 +0900
From: Alexandre Courbot <gnurou@...il.com>
To: Mark Brown <broonie@...nel.org>
Cc: Linus Walleij <linus.walleij@...aro.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linaro-kernel@...ts.linaro.org, Mark Brown <broonie@...aro.org>
Subject: Re: [PATCH] gpiolib: Don't allow drivers to specify a base with DT
On Thu, Jul 31, 2014 at 9:07 PM, Mark Brown <broonie@...nel.org> wrote:
> From: Mark Brown <broonie@...aro.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.
I agree that DT users should not use the base number at all - but the
fact is some of them are doing it. Aren't we going to break some
user-space users that will expect to find a GPIO under a given number?
Also, how is this going to help with gpio_is_valid() against
zero-initialized data?
>
> Signed-off-by: Mark Brown <broonie@...aro.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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists