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

From: Mark Brown
Date: Mon Aug 11 2014 - 08:38:54 EST


On Mon, Aug 04, 2014 at 01:21:57PM +0900, Alexandre Courbot wrote:
> On Thu, Jul 31, 2014 at 9:07 PM, Mark Brown <broonie@xxxxxxxxxx> wrote:

> > 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?

Is this actually a realistic thing that people do with mainline - I'm
not convinced that it's going to be robust in general (a lot of DT
conversions will have broken things for entire architectures) and hard
coded numbers aren't the sort of things that make it into distros.

> Also, how is this going to help with gpio_is_valid() against
> zero-initialized data?

I should have said check for zero instead, sorry - though making 0 not
be a valid GPIO would help overall.

Attachment: signature.asc
Description: Digital signature