aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2015-08-06 22:15:30 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-08-07 17:55:38 -0400
commit00159f19a5057cb779146afce1cceede692af346 (patch)
tree088387908b23ecf425fde41f80720823598488fe
parent6fd3850227961d70594acd45d146ad28367415b5 (diff)
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>
-rw-r--r--drivers/input/input.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 78d24990a816..5391abd28b27 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -674,13 +674,19 @@ EXPORT_SYMBOL(input_close_device);
674 */ 674 */
675static void input_dev_release_keys(struct input_dev *dev) 675static void input_dev_release_keys(struct input_dev *dev)
676{ 676{
677 bool need_sync = false;
677 int code; 678 int code;
678 679
679 if (is_event_supported(EV_KEY, dev->evbit, EV_MAX)) { 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 input_pass_event(dev, EV_KEY, code, 0); 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 memset(dev->key, 0, sizeof(dev->key)); 689 memset(dev->key, 0, sizeof(dev->key));
683 input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
684 } 690 }
685} 691}
686 692