Messages in this thread | | | Date | Thu, 16 Oct 2008 20:35:23 +0400 | From | Anton Vorontsov <> | Subject | Re: [PATCH] gpiolib: fix oops on reading sysfs exported GPIOs |
| |
On Thu, Oct 16, 2008 at 08:43:08AM -0700, David Brownell wrote: [...] > > GPIO users should always issue the gpio_direction_input() call and > > check its return value prior to trying gpio_get_value(). > > Not true; the API explicitly allows GPIOs to be treated > as bidirectional, even when they're configured as outputs. > That's because most GPIOs *are* bidirectional.
I just recalling somebody was speaking about not wasting cycles with the checks in the gpio_{set,get}_value(). And the solution was that before using the gpio_{set,get} one should always try to issue the "direction" calls to ensure that gpio controller is capable of that direction... That way gpio_{set,get}_value() don't have to check anything.
Though I can't find the discussion now, maybe it was a dream... :-)
Thanks,
-- Anton Vorontsov email: cbouatmailru@gmail.com irc://irc.freenode.net/bd2
| |