[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1562581119.10420.8.camel@phaseone.com>
Date: Mon, 8 Jul 2019 12:18:39 +0200
From: "Claus H. Stovgaard" <cst@...seone.com>
To: Bartosz Golaszewski <brgl@...ev.pl>,
Linus Walleij <linus.walleij@...aro.org>
CC: <linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"Bartosz Golaszewski" <bgolaszewski@...libre.com>
Subject: Re: [PATCH] gpio: don't WARN() on NULL descs if gpiolib is disabled
On Mon, 2019-07-08 at 10:23 +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@...libre.com>
>
> If gpiolib is disabled, we use the inline stubs from gpio/consumer.h
> instead of regular definitions of GPIO API. The stubs for 'optional'
> variants of gpiod_get routines return NULL in this case as if the
> relevant GPIO wasn't found. This is correct so far.
>
> Calling other (non-gpio_get) stubs from this header triggers a
> warning
> because the GPIO descriptor couldn't have been requested. The warning
> however is unconditional (WARN_ON(1)) and is emitted even if the
> passed
> descriptor pointer is NULL.
>
> We don't want to force the users of 'optional' gpio_get to check the
> returned pointer before calling e.g. gpiod_set_value() so let's only
> WARN on non-NULL descriptors.
>
> Reported-by: Claus H. Stovgaard <cst@...seone.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
> ---
> include/linux/gpio/consumer.h | 64 +++++++++++++++++--------------
> ----
> 1 file changed, 32 insertions(+), 32 deletions(-)
Have tested it on my setup (ZynqMP with AT24 EEPROM), where it works
great. This have removed the warnings in the log regarding settting
wp_gpio for AT24.
Thanks
Claus
Powered by blists - more mailing lists