]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Input: do not emit unneeded EV_SYN when suspending
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 7 Aug 2015 02:15:30 +0000 (19:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Feb 2018 19:07:53 +0000 (11:07 -0800)
commit 00159f19a5057cb779146afce1cceede692af346 upstream.

Do not emit EV_SYN/SYN_REPORT on suspend if there were no keys that are
still pressed as we are suspending the device (and in all other cases when
input core is forcibly releasing keys via input_dev_release_keys() call).

Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Bo Hu <bohu@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/input.c

index 0f175f55782b4113e37229a5f47d37a27f8cf7bd..34aae7e5498a7d8b19746534a59091831aed7822 100644 (file)
@@ -668,6 +668,7 @@ EXPORT_SYMBOL(input_close_device);
  */
 static void input_dev_release_keys(struct input_dev *dev)
 {
+       bool need_sync = false;
        int code;
 
        if (is_event_supported(EV_KEY, dev->evbit, EV_MAX)) {
@@ -675,9 +676,11 @@ static void input_dev_release_keys(struct input_dev *dev)
                        if (is_event_supported(code, dev->keybit, KEY_MAX) &&
                            __test_and_clear_bit(code, dev->key)) {
                                input_pass_event(dev, EV_KEY, code, 0);
+                               need_sync = true;
                        }
                }
-               input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
+               if (need_sync)
+                       input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
        }
 }