Before reading GPIOs in a poller check if they are available. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- drivers/input/gpio_keys.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/input/gpio_keys.c b/drivers/input/gpio_keys.c index fd3995d01f..c23d20563c 100644 --- a/drivers/input/gpio_keys.c +++ b/drivers/input/gpio_keys.c @@ -40,6 +40,13 @@ static void gpio_key_poller(void *data) struct gpio_key *gb; int i, val; + for (i = 0; i < gk->nbuttons; i++) { + gb = &gk->buttons[i]; + + if (gpio_slice_acquired(gb->gpio)) + goto out; + } + for (i = 0; i < gk->nbuttons; i++) { gb = &gk->buttons[i]; @@ -58,7 +65,7 @@ static void gpio_key_poller(void *data) gb->previous_state = val; } } - +out: poller_call_async(&gk->poller, 10 * MSECOND, gpio_key_poller, gk); } -- 2.39.2