From 6c5bfaac84b085df813cf4e620981b94fa2a77cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Tue, 4 Jun 2019 13:14:41 +0200 Subject: [PATCH] gpio-button-hotplug: gpio-keys: fix always missing first event MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Commit afc056d7dc83 ("gpio-button-hotplug: support interrupt properties") changed the gpio-keys interrupt handling logic in a way, that it always misses first event, which causes issues with rc.button scripts, so this patch restores the previous behaviour. Fixes: afc056d7dc83 ("gpio-button-hotplug: support interrupt properties") Reported-by: Kristian Evensen Tested-by: Kuan-Yi Li Signed-off-by: Petr Å tetiar Signed-off-by: Christian Lamparter [drop state check] --- .../gpio-button-hotplug/src/gpio-button-hotplug.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index f429f8c027..daa4b2a4f7 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -340,16 +340,9 @@ static void gpio_keys_irq_work_func(struct work_struct *work) { struct gpio_keys_button_data *bdata = container_of(work, struct gpio_keys_button_data, work.work); - int state = gpio_button_get_value(bdata); - if (state != bdata->last_state) { - unsigned int type = bdata->b->type ?: EV_KEY; - - if (bdata->last_state != -1 || type == EV_SW) - button_hotplug_event(bdata, type, state); - - bdata->last_state = state; - } + button_hotplug_event(bdata, bdata->b->type ?: EV_KEY, + gpio_button_get_value(bdata)); } static irqreturn_t button_handle_irq(int irq, void *_bdata) -- 2.25.1