mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 15:11:31 +00:00
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 <broonie@opensource.wolfsonmicro.com> Reviwed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
parent
25553ff075
commit
e4e449e828
@ -1581,6 +1581,7 @@ int __gpio_get_value(unsigned gpio)
|
|||||||
int value;
|
int value;
|
||||||
|
|
||||||
chip = gpio_to_chip(gpio);
|
chip = gpio_to_chip(gpio);
|
||||||
|
/* Should be using gpio_get_value_cansleep() */
|
||||||
WARN_ON(chip->can_sleep);
|
WARN_ON(chip->can_sleep);
|
||||||
value = chip->get ? chip->get(chip, gpio - chip->base) : 0;
|
value = chip->get ? chip->get(chip, gpio - chip->base) : 0;
|
||||||
trace_gpio_value(gpio, 1, value);
|
trace_gpio_value(gpio, 1, value);
|
||||||
@ -1653,6 +1654,7 @@ void __gpio_set_value(unsigned gpio, int value)
|
|||||||
struct gpio_chip *chip;
|
struct gpio_chip *chip;
|
||||||
|
|
||||||
chip = gpio_to_chip(gpio);
|
chip = gpio_to_chip(gpio);
|
||||||
|
/* Should be using gpio_set_value_cansleep() */
|
||||||
WARN_ON(chip->can_sleep);
|
WARN_ON(chip->can_sleep);
|
||||||
trace_gpio_value(gpio, 0, value);
|
trace_gpio_value(gpio, 0, value);
|
||||||
if (test_bit(FLAG_OPEN_DRAIN, &gpio_desc[gpio].flags))
|
if (test_bit(FLAG_OPEN_DRAIN, &gpio_desc[gpio].flags))
|
||||||
|
Loading…
Reference in New Issue
Block a user