aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-09-04 08:17:08 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-09-04 08:22:47 -0400
commit65d876564e989b63b0f769e0e06b9830db97b2d9 (patch)
tree2549b0ba6ad1aa90f049cdc35ebf75ddd50b6271 /drivers/gpio
parentbe1a4b13089b1e18da83a549d49163ccad3c19ba (diff)
gpio: return -ENOTSUPP if debounce cannot be set
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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 0cbdddab4ff2..86ef3461ec06 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1763,6 +1763,9 @@ EXPORT_SYMBOL_GPL(gpio_direction_output);
1763 * gpio_set_debounce - sets @debounce time for a @gpio 1763 * gpio_set_debounce - sets @debounce time for a @gpio
1764 * @gpio: the gpio to set debounce time 1764 * @gpio: the gpio to set debounce time
1765 * @debounce: debounce time is microseconds 1765 * @debounce: debounce time is microseconds
1766 *
1767 * returns -ENOTSUPP if the controller does not support setting
1768 * debounce.
1766 */ 1769 */
1767static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) 1770static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
1768{ 1771{
@@ -1778,9 +1781,9 @@ static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
1778 1781
1779 chip = desc->chip; 1782 chip = desc->chip;
1780 if (!chip->set || !chip->set_debounce) { 1783 if (!chip->set || !chip->set_debounce) {
1781 pr_warn("%s: missing set() or set_debounce() operations\n", 1784 pr_debug("%s: missing set() or set_debounce() operations\n",
1782 __func__); 1785 __func__);
1783 return -EIO; 1786 return -ENOTSUPP;
1784 } 1787 }
1785 1788
1786 spin_lock_irqsave(&gpio_lock, flags); 1789 spin_lock_irqsave(&gpio_lock, flags);