Hi Linus,

On Sun, Nov 24, 2013 at 09:37:45AM -0300, Ezequiel Garcia wrote:
> These warnings can be very spammy, since they could be called from
> kernel threads. Use WARN_ON_ONCE, which is enough to warn developers
> about the 'can_sleep' usage.
> 
> Signed-off-by: Ezequiel Garcia <[email protected]>
> ---
>  drivers/gpio/gpiolib.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 7dd4461..9568998 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1927,7 +1927,7 @@ int gpiod_get_raw_value(const struct gpio_desc *desc)
>       if (!desc)
>               return 0;
>       /* Should be using gpio_get_value_cansleep() */
> -     WARN_ON(desc->chip->can_sleep);
> +     WARN_ON_ONCE(desc->chip->can_sleep);
>       return _gpiod_get_raw_value(desc);
>  }
>  EXPORT_SYMBOL_GPL(gpiod_get_raw_value);
> @@ -1948,7 +1948,7 @@ int gpiod_get_value(const struct gpio_desc *desc)
>       if (!desc)
>               return 0;
>       /* Should be using gpio_get_value_cansleep() */
> -     WARN_ON(desc->chip->can_sleep);
> +     WARN_ON_ONCE(desc->chip->can_sleep);
>  
>       value = _gpiod_get_raw_value(desc);
>       if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
> @@ -2042,7 +2042,7 @@ void gpiod_set_raw_value(struct gpio_desc *desc, int 
> value)
>       if (!desc)
>               return;
>       /* Should be using gpio_set_value_cansleep() */
> -     WARN_ON(desc->chip->can_sleep);
> +     WARN_ON_ONCE(desc->chip->can_sleep);
>       _gpiod_set_raw_value(desc, value);
>  }
>  EXPORT_SYMBOL_GPL(gpiod_set_raw_value);
> @@ -2063,7 +2063,7 @@ void gpiod_set_value(struct gpio_desc *desc, int value)
>       if (!desc)
>               return;
>       /* Should be using gpio_set_value_cansleep() */
> -     WARN_ON(desc->chip->can_sleep);
> +     WARN_ON_ONCE(desc->chip->can_sleep);
>       if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
>               value = !value;
>       _gpiod_set_raw_value(desc, value);
> -- 
> 1.8.1.5
> 

Any comments on this?
-- 
Ezequiel GarcĂ­a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to