From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: linux-gpio@vger.kernel.org
Cc: linus.walleij@linaro.org
Subject: Re: [PATCH] gpiolib: Replace WARN_ON with WARN_ON_ONCE
Date: Thu, 28 Nov 2013 16:16:56 -0300 [thread overview]
Message-ID: <20131128191655.GC13182@localhost> (raw)
In-Reply-To: <1385296665-23713-1-git-send-email-ezequiel.garcia@free-electrons.com>
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 <ezequiel.garcia@free-electrons.com>
> ---
> 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-11-28 19:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-24 12:37 [PATCH] gpiolib: Replace WARN_ON with WARN_ON_ONCE Ezequiel Garcia
2013-11-28 19:16 ` Ezequiel Garcia [this message]
2013-11-29 12:27 ` Linus Walleij
2013-12-01 3:07 ` Alexandre Courbot
2013-12-02 10:02 ` Ezequiel Garcia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131128191655.GC13182@localhost \
--to=ezequiel.garcia@free-electrons.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.