Skip to content

Commit e4e449e

Browse files
broonieglikely
authored andcommitted
gpiolib: Add comments explaining the _cansleep() WARN_ON()s
I've seen users getting very confused by the WARN_ON()s for can_sleep GPIOs in the atomic-safe paths, the discoverability of the non-atomic version of the API seems to be hampered by the fact that it's defined in a header file not the .c file where the warnings are. Add a couple of comments next to the warnings to help people on their way. Signed-off-by: Mark Brown <[email protected]> Reviwed-by: Mark Brown <[email protected]> Signed-off-by: Grant Likely <[email protected]>
1 parent 25553ff commit e4e449e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/gpio/gpiolib.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,7 @@ int __gpio_get_value(unsigned gpio)
15811581
int value;
15821582

15831583
chip = gpio_to_chip(gpio);
1584+
/* Should be using gpio_get_value_cansleep() */
15841585
WARN_ON(chip->can_sleep);
15851586
value = chip->get ? chip->get(chip, gpio - chip->base) : 0;
15861587
trace_gpio_value(gpio, 1, value);
@@ -1653,6 +1654,7 @@ void __gpio_set_value(unsigned gpio, int value)
16531654
struct gpio_chip *chip;
16541655

16551656
chip = gpio_to_chip(gpio);
1657+
/* Should be using gpio_set_value_cansleep() */
16561658
WARN_ON(chip->can_sleep);
16571659
trace_gpio_value(gpio, 0, value);
16581660
if (test_bit(FLAG_OPEN_DRAIN, &gpio_desc[gpio].flags))

0 commit comments

Comments
 (0)