Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33fd3685 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman
Browse files

Input: do not emit unneeded EV_SYN when suspending



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: default avatarBenson Leung <bleung@chromium.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarBo Hu <bohu@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 90aaf2f2
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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,8 +676,10 @@ 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;
			}
		}
		if (need_sync)
			input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
	}
}