Skip to content

Commit 03a58ea

Browse files
warthog618brgl
authored andcommitted
gpiolib: cdev: clear debounce period if line set to output
When set_config changes a line from input to output debounce is implicitly disabled, as debounce makes no sense for outputs, but the debounce period is not being cleared and is still reported in the line info. So clear the debounce period when the debouncer is stopped in edge_detector_stop(). Fixes: 65cff70 ("gpiolib: cdev: support setting debounce") Cc: stable@vger.kernel.org Signed-off-by: Kent Gibson <warthog618@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
1 parent 6ee1d74 commit 03a58ea

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/gpio/gpiolib-cdev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,8 @@ static void edge_detector_stop(struct line *line)
776776
cancel_delayed_work_sync(&line->work);
777777
WRITE_ONCE(line->sw_debounced, 0);
778778
WRITE_ONCE(line->eflags, 0);
779+
if (line->desc)
780+
WRITE_ONCE(line->desc->debounce_period_us, 0);
779781
/* do not change line->level - see comment in debounced_value() */
780782
}
781783

0 commit comments

Comments
 (0)