Re: [PATCH] gpiolib: Don't allow drivers to specify a base with DT

From: Linus Walleij
Date: Mon Aug 11 2014 - 03:26:56 EST


On Thu, Jul 31, 2014 at 2:07 PM, Mark Brown <broonie@xxxxxxxxxx> wrote:

> From: Mark Brown <broonie@xxxxxxxxxx>
>
> 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.

Hm in principle you are right...

> - if (base < 0) {
> + if (base < 0 || of_have_populated_dt()) {
> base = gpiochip_find_base(chip->ngpio);

But here I worry about breaking in-transition systems, e.g.
defining part of the peripherals through DT but adding a
GPIO device with AUXDATA, setting up base that way.

Not that it should stay that way for sure, but it does need
some consideration...

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/