Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: do not emit unneeded EV_SYN when suspending

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>

+8 -2
+8 -2
drivers/input/input.c
··· 674 674 */ 675 675 static void input_dev_release_keys(struct input_dev *dev) 676 676 { 677 + bool need_sync = false; 677 678 int code; 678 679 679 680 if (is_event_supported(EV_KEY, dev->evbit, EV_MAX)) { 680 - for_each_set_bit(code, dev->key, KEY_CNT) 681 + for_each_set_bit(code, dev->key, KEY_CNT) { 681 682 input_pass_event(dev, EV_KEY, code, 0); 683 + need_sync = true; 684 + } 685 + 686 + if (need_sync) 687 + input_pass_event(dev, EV_SYN, SYN_REPORT, 1); 688 + 682 689 memset(dev->key, 0, sizeof(dev->key)); 683 - input_pass_event(dev, EV_SYN, SYN_REPORT, 1); 684 690 } 685 691 } 686 692