[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdZxHPEHqPA5WQzfS722q7f0cVbJAOvd9xK-rKZKaEk6mg@mail.gmail.com>
Date: Wed, 15 Jan 2014 08:55:35 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Gerhard Sittig <gsi@...x.de>
Cc: Neil Zhang <zhangwm@...vell.com>,
Alexandre Courbot <gnurou@...il.com>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpio: pxa: fix bug when get gpio value
On Thu, Jan 9, 2014 at 11:46 AM, Gerhard Sittig <gsi@...x.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
--
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