]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
gpio: return -ENOTSUPP if debounce cannot be set
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 4 Sep 2013 12:17:08 +0000 (14:17 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 4 Sep 2013 12:22:47 +0000 (14:22 +0200)
It appears some drivers are using gpio_set_debounce()
opportunistically, i.e. without knowing whether it works or
not. (Example: input/keyboard/gpio_keys.c) to account for
this use case, return -ENOTSUPP and do not print any
warnings in this case.

Took a round over the other gpio_set_debounce() consumers
to make sure that none of them are relying on the returned
error code to be something specific.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c

index 0cbdddab4ff2be9987093566287d4ca350fc56d9..86ef3461ec0647b42f1e1ff94a9f47225151f7f6 100644 (file)
@@ -1763,6 +1763,9 @@ EXPORT_SYMBOL_GPL(gpio_direction_output);
  * gpio_set_debounce - sets @debounce time for a @gpio
  * @gpio: the gpio to set debounce time
  * @debounce: debounce time is microseconds
+ *
+ * returns -ENOTSUPP if the controller does not support setting
+ * debounce.
  */
 static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
 {
@@ -1778,9 +1781,9 @@ static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
 
        chip = desc->chip;
        if (!chip->set || !chip->set_debounce) {
-               pr_warn("%s: missing set() or set_debounce() operations\n",
+               pr_debug("%s: missing set() or set_debounce() operations\n",
                        __func__);
-               return -EIO;
+               return -ENOTSUPP;
        }
 
        spin_lock_irqsave(&gpio_lock, flags);