Hey Linus,

thanks for doing this.

On Sun, Dec 10, 2017 at 01:23:40AM +0100, Linus Walleij wrote:
> The gpiod_get_direction() returns 1 for input and 0 for output
> but it's pretty hard to remember which one is which and generally
> unintuitive and messy to provide #defines so let's simply add
> two static inlines to do the job.
> 
> Cc: Wolfram Sang <w...@the-dreams.de>
> Suggested-by: Wolfram Sang <w...@the-dreams.de>
> Signed-off-by: Linus Walleij <linus.wall...@linaro.org>
> ---
>  Documentation/gpio/consumer.txt | 14 +++++++++++---
>  include/linux/gpio/consumer.h   | 25 +++++++++++++++++++++++++
>  2 files changed, 36 insertions(+), 3 deletions(-)

You need to fix the kerneldoc for 'gpiod_get_direction", too. It still
mentions GPIOF_DIR_*.

> +static inline bool gpiod_is_input(struct gpio_desc *desc)
> +{
> +     int ret = gpiod_get_direction(desc);
> +     if (ret < 0) {
> +             pr_err("GPIO: failed to get direction\n");

Is that really helpful for the user if we don't say which GPIO failed?

> +             /* It is usually safest to assume we are input */
> +             return true;
> +     }
> +     return !!ret;
> +}

Regards,

   Wolfram

Attachment: signature.asc
Description: PGP signature

Reply via email to