lkml.org 
[lkml]   [2014]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] gpio: add flags argument to gpiod_get*() functions
From
On Fri, Jul 25, 2014 at 4:38 PM, Alexandre Courbot <acourbot@nvidia.com> wrote:

> The huge majority of GPIOs have their direction and initial value set
> right after being obtained by one of the gpiod_get() functions. The
> integer GPIO API had gpio_request_one() that took a convenience flags
> parameter allowing to specify an direction and value applied to the
> returned GPIO. This feature greatly simplifies client code and ensures
> errors are always handled properly.
>
> A similar feature has been requested for the gpiod API. Since setting
> the direction of a GPIO is so often the very next action done after
> obtaining its descriptor, we prefer to extend the existing functions
> instead of introducing new functions that would raise the
> number of gpiod getters to 16 (!).
>
> The drawback of this approach is that all gpiod clients need to be
> updated. To limit the pain, temporary macros are introduced that allow
> gpiod_get*() to be called with or without the extra flags argument. They
> will be removed once all consumer code has been updated.
>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> This dude can be applied harmlessly to the GPIO tree - then I will go
> after every gpiod user to update the calls to gpiod_get*() before
> removing the macros in consumer.h.

OK I trust you. Patch applied with Broonie's review tag.

Just so we don't forget how we should move forward: Alex what do
you think about adding a drivers/gpio/TODO.TXT file outlining the
overall plan of the gpiod refactoring and clean-up work?

Yours,
Linus Walleij


\
 
 \ /
  Last update: 2014-07-28 13:01    [W:0.083 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site