Messages in this thread | | | Date | Wed, 15 Jan 2014 08:55:35 +0100 | Subject | Re: [PATCH] gpio: pxa: fix bug when get gpio value | From | Linus Walleij <> |
| |
On Thu, Jan 9, 2014 at 11:46 AM, Gerhard Sittig <gsi@denx.de> wrote:
> Here is why I'm asking: Is there a need from GPIO get_value() > routines to return normalized values,
That totally depends.
All drivers calling gpio[d]_get_value() will be returned the value directly from the driver without any clamping to [0,1] in gpiolib. These are 496 occurences in the kernel, you'd have to check them all to see if they expect this or not.
Hm. Maybe we should clamp it in gpiolib...
> and if so should not more > drivers receive an update?
Probably. But on my part I want that more as a code readability and maintenance hygiene thing, it gives a clear sign that the driver author think about details.
(Possibly it gives the compiler a chance to optimize stuff also, I don't quite know that.)
> If the GPIO subsystem's API wants to guarantee values of 0 and 1 > (which I think it doesn't), then I feel the adjustment should be > done in the gpio_get_value() routines (in all its public > variants, or a common routine which all of them pass through), > and certainly not in individual chip drivers.
One does not exclude the other.
Yours, Linus Walleij
| |