From 9080007ef9c46b813a67e0a5845b052e1fe7b1c5 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Tue, 28 Nov 2023 15:30:56 +0000 Subject: [PATCH] input: gpio_keys: drop the pin filter from the callback The bit check field is redundant since the callback struct is masked to a single pin already. Drop it, simplify the code a bit. Signed-off-by: Fabio Baltieri --- drivers/input/input_gpio_keys.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/input/input_gpio_keys.c b/drivers/input/input_gpio_keys.c index 28cb8875e4..aca17d466c 100644 --- a/drivers/input/input_gpio_keys.c +++ b/drivers/input/input_gpio_keys.c @@ -65,30 +65,19 @@ static void gpio_keys_change_deferred(struct k_work *work) } } -static void gpio_keys_change_call_deferred(struct gpio_keys_pin_data *data, uint32_t msec) -{ - int __maybe_unused rv = k_work_reschedule(&data->work, K_MSEC(msec)); - - __ASSERT(rv >= 0, "Set wake mask work queue error"); -} - static void gpio_keys_interrupt(const struct device *dev, struct gpio_callback *cbdata, uint32_t pins) { - ARG_UNUSED(dev); /* This is a pointer to GPIO device, use dev pointer in - * cbdata for pointer to gpio_debounce device node - */ struct gpio_keys_callback *keys_cb = CONTAINER_OF( cbdata, struct gpio_keys_callback, gpio_cb); struct gpio_keys_pin_data *pin_data = CONTAINER_OF( keys_cb, struct gpio_keys_pin_data, cb_data); const struct gpio_keys_config *cfg = pin_data->dev->config; - for (int i = 0; i < cfg->num_keys; i++) { - if (pins & BIT(cfg->pin_cfg[i].spec.pin)) { - gpio_keys_change_call_deferred(pin_data, cfg->debounce_interval_ms); - } - } + ARG_UNUSED(dev); /* GPIO device pointer. */ + ARG_UNUSED(pins); + + k_work_reschedule(&pin_data->work, K_MSEC(cfg->debounce_interval_ms)); } static int gpio_keys_interrupt_configure(const struct gpio_dt_spec *gpio_spec,