linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpiolib: Replace WARN_ON with WARN_ON_ONCE
@ 2013-11-24 12:37 Ezequiel Garcia
  2013-11-28 19:16 ` Ezequiel Garcia
  0 siblings, 1 reply; 5+ messages in thread
From: Ezequiel Garcia @ 2013-11-24 12:37 UTC (permalink / raw)
  To: linux-gpio; +Cc: linus.walleij, Ezequiel Garcia

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-12-02 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-24 12:37 [PATCH] gpiolib: Replace WARN_ON with WARN_ON_ONCE Ezequiel Garcia
2013-11-28 19:16 ` Ezequiel Garcia
2013-11-29 12:27   ` Linus Walleij
2013-12-01  3:07     ` Alexandre Courbot
2013-12-02 10:02       ` Ezequiel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).