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 <fabiobaltieri@google.com>
This commit is contained in:
parent
f6917bca14
commit
9080007ef9
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue