Re: [GIT PULL] GPIO changes for v3.6

From: Mark Brown
Date: Mon Jul 30 2012 - 09:36:11 EST


On Mon, Jul 30, 2012 at 04:57:33PM +1000, NeilBrown wrote:

> it means that if !gpio_is_valid(gpio), the error returned is EPROBE_DEFER
> which isn't right (an invalid gpio number will never become valid).
> If a driver happened to use gpio_request to check the validity of the gpio
> rather than doing it itself, it would defer the probe, rather than assume
> that the GPIO doesn't exist.

Is anything actually doing this? For positive numbers that just seems
like it's asking for things to explode, for negative numbers I guess you
can get away with it at the minute though it's obviously not awesome
error handling.

> I would suggest the following. Reasonable?

TBH I'd actually expect that gpio_is_valid() were checking that there's
a gpio_chip behind the GPIO number, now I look at the implementation
it's very surprising to me that it's just checking the GPIO array bounds
(and also that we remove the need for the fixed size GPIO array which is
just an endless source of annoyance).
--
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/