public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: do not emit unneeded EV_SYN when suspending
@ 2015-08-07  2:26 Dmitry Torokhov
  2015-08-07  4:10 ` Benson Leung
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2015-08-07  2:26 UTC (permalink / raw)
  To: linux-input; +Cc: Benson Leung, linux-kernel

Do not emit EV_SYN/SYN_REPORT on suspend if there were no keys that are
still pressed as we are suspending the device.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/input.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 78d2499..5391abd 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -674,13 +674,19 @@ 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)) {
-		for_each_set_bit(code, dev->key, KEY_CNT)
+		for_each_set_bit(code, dev->key, KEY_CNT) {
 			input_pass_event(dev, EV_KEY, code, 0);
+			need_sync = true;
+		}
+
+		if (need_sync)
+			input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
+
 		memset(dev->key, 0, sizeof(dev->key));
-		input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
 	}
 }
 
-- 
2.5.0.rc2.392.g76e840b


-- 
Dmitry

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: do not emit unneeded EV_SYN when suspending
  2015-08-07  2:26 [PATCH] Input: do not emit unneeded EV_SYN when suspending Dmitry Torokhov
@ 2015-08-07  4:10 ` Benson Leung
  0 siblings, 0 replies; 2+ messages in thread
From: Benson Leung @ 2015-08-07  4:10 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org

On Thu, Aug 6, 2015 at 7:26 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Do not emit EV_SYN/SYN_REPORT on suspend if there were no keys that are
> still pressed as we are suspending the device.

It looks like input_dev_release_keys is used in several other places
other than input_dev_suspend (reset, disconnect, freeze), so maybe
change the commit message to reflect that?

Otherwise, LGTM.


-- 
Benson Leung
Software Engineer, Chrom* OS
bleung@chromium.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-07  4:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-07  2:26 [PATCH] Input: do not emit unneeded EV_SYN when suspending Dmitry Torokhov
2015-08-07  4:10 ` Benson Leung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox